Instantly share code, notes, and snippets.

View GET Provider Code curl Request
curl -X GET -G \
-H 'Content-Type: application/json' \
--data 'apiKey=<INSERT>&apiSecret=<INSERT>&callbackUrl=<INSERT>' \
'https://staging.cloud-elements.com/elements/api-v2/elements/23/oauth/url'
View playground.rs
#[no_mangle]
pub extern "C" fn fill(pointer: *mut u8, max_width: usize, max_height: usize, time: f64) -> i32 {
// pixels are stored in RGBA, so each pixel is 4 bytes
let byte_size = max_width * max_height * 4;
let sl = unsafe { slice::from_raw_parts_mut(pointer, byte_size) };
let font = parse(&someFont).unwrap();
let glyph_id: u16 = 77;
//font.render_glyph(glyph_id, 400); // fails if this is uncommented
sl[11] = (128.0 + 0.5 * 128.0) as u8;
View virtualservice.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: servicemesh
spec:
gateways:
- gateway
hosts:
- '*'
http:
View untrusted-lvl5-solution.js
/******************
* minesweeper.js *
******************
*
* So much for Asimov's Laws. They're actually trying to kill
* you now. Not to be alarmist, but the floor is littered
* with mines. Rushing for the exit blindly may be unwise.
* I need you alive, after all.
*
* If only there was some way you could track the positions
View 122018-mlha-us-pfc2.jsx
class App extends React.Component {
constructor(props) {
super(props)
this.state = {
count: 0
}
}
add = () => {
this.setState({
View untrusted-lvl5-solution.js
/******************
* minesweeper.js *
******************
*
* So much for Asimov's Laws. They're actually trying to kill
* you now. Not to be alarmist, but the floor is littered
* with mines. Rushing for the exit blindly may be unwise.
* I need you alive, after all.
*
* If only there was some way you could track the positions
View PY0101EN-2-1-Tuples.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View medium_codequaljs_letarray.js
// No need to use "let" here since we never reassign the arr
const arr = [];
arr.push({ property: 1 });
// Only if we want to clear the array
let arr = []
arr.push({ property: 1 });
arr = [];
View UIColor+HSV.swift
extension UIColor {
/// The components of a color in the HSV color model (hue, saturation, value).
typealias HSV = (
hue: CGFloat, // 0 to 1 (% of 360°)
saturation: CGFloat, // 0 to 1 (% of 100)
value: CGFloat // 0 to 1 (% of 100)
)
/// The components of the color in the HSV color model.