Skip to content

Instantly share code, notes, and snippets.

View cmoody's full-sized avatar

Chase Moody cmoody

View GitHub Profile
@cmoody
cmoody / sonic_pi_chopsticks.rb
Created May 5, 2020 02:33
Chopsticks in sonic pi
use_bpm 165
##| Left Hand, Right Hand
define :time_loop do |loop_number, right_hand, left_hand|
loop_number.times do
play right_hand
play left_hand
sleep 1
end
end
const data = {
Place: {
Name: 'Veracruz Tacos',
Address: '1704 E Cesar Chavez Austin, TX 78702',
Phone: '512.981.1760'
}
};
let { Name, Address, Phone, PriceRange } = data.Place;
// Received from API call
const data = {
Place: {
Name: 'Veracruz Tacos',
Address: '1704 E Cesar Chavez Austin, TX 78702',
Phone: '512.981.1760'
}
};
// Without destructuring
@cmoody
cmoody / arr-destructure.js
Last active March 31, 2016 20:13
Array Destructuring
// Array destructure
let arr = [9, 8, 7, 6, 5, 4, 3, 2, 1];
let [a, b, ...numbers] = arr;
console.log(a); // returns 9
console.log(b); // returns 8
console.log(numbers); // returns [7, 6, 5, 4, 3, 2, 1];
@cmoody
cmoody / CanvasBoilerplate
Created February 5, 2013 03:31
Basic boilerplate for canvas animation.
// Animation variables
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var canvasWidth = canvas.width;
var canvasHeight = canvas.height;
//var base = new Image();
// Paul Irish RequestAnimationFrame Gist https://gist.github.com/1579671
(function() {
var lastTime = 0;