This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# C code | |
#include <stdio.h> | |
#include <inttypes.h> | |
#int main () { | |
# int64_t nums [3000] = {0}; | |
# printf("%lld\n", nums[0]); | |
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is useful if you want to do something with the icons | |
// AFTER they've ALL been loaded. Some apps don't have | |
// icons listed in their manifests, and some have icons | |
// listed without actually having the actual asset or | |
// result in 404's. Here I just skip them by decrementing | |
// numToLoad, but if you still want to be able to launch the | |
// app, then you'd want to push a default icon into icons. | |
function loadIcons (cb) { | |
navigator.mozApps.mgmt.getAll().onsuccess = function (e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run with `node.js v0.11.13: node --harmony file.js` | |
// Comment out/in fs.stat & setTimeout blocks. Based on: | |
// http://strongloop.com/strongblog/how-to-generators-node-js-yield-use-cases/ | |
function thunkify (fn) { // fn === fs.stat xor setTimeout | |
return function b () { | |
// args === [__filename] xor [after, 1000] | |
var args = Array.prototype.slice.call(arguments); | |
return function c (cb) { // cb === pump | |
args.push(cb); | |
// args === [__filename, pump] xor [after, 1000, pump] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang -S source.c | |
// Single if | |
if (x > 0) { | |
... | |
} | |
becomes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am nickdesaulniers on github. | |
* I am nickd (https://keybase.io/nickd) on keybase. | |
* I have a public key whose fingerprint is 90C1 6D8E E59C B152 9D99 F861 027B 59AE 4389 4A07 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Takeaways: | |
// 1. always return a promise, so you can chain .then calls | |
// 2. arrays of Promises can be passed to Promise.all or Promise.race | |
var parse = require('csv-parse'); | |
var XMLHttpRequestPromise = require('xhr-promise'); | |
var prefix = '../gtfs_caltrain_devs/'; | |
// An array of strings | |
var csvs = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mat4.multiply = function (out, a, b) { | |
if (SIMD) { | |
mat4.multiply = function (out, a, b) { | |
// https://www.youtube.com/watch?v=DXPfE2jGqg0 | |
// http://drrobsjournal.blogspot.com/2012/10/fast-simd-4x4-matrix-multiplication.html | |
var _a = SIMD.Float32x4(b[0], b[1], b[2], b[3]); | |
var _b = SIMD.Float32x4(b[4], b[5], b[6], b[7]); | |
var _c = SIMD.Float32x4(b[8], b[9], b[10], b[11]); | |
var _d = SIMD.Float32x4(b[12], b[13], b[14], b[15]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var period = 2; // seconds | |
var amplitude = 0.5; | |
var verticalOffset = 0; | |
function nowSeconds () { | |
return performance.now() * 0.001; | |
} | |
function makeOscillate (amplitude, period, verticalOffset) { | |
return function (nowSeconds) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<scene> | |
<group translateY="1.0" rotateY="0.78"> | |
<cube scaleX="2.75" translateY="1.0"/> | |
<sphere translateX="1.0"/> | |
<sphere translateX="-1.0"/> | |
</group> | |
</scene> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Giraffe by Nick Desaulniers BrazilJS 8/22/15 --> | |
<scene> | |
<group id="tree" translateX="-0.98"> | |
<cube id="trunk" scaleY="3.26" scaleX="0.47"/> | |
<cube id="rightBranch" translateY="1.87" rotateZ="-0.36" scaleY="1.28" scaleX="0.23" translateX="0.19"/> | |
<cube id="middleBranch" translateY="2.15" rotateZ="0.00" scaleY="1.28" scaleX="0.23" translateX="-0.09"/> | |
<cube id="leftBranch" translateY="1.87" rotateZ="0.51" scaleY="1.28" scaleX="0.23" translateX="-0.46"/> | |
<group id="leaves" translateZ="0.28" translateY="-0.09"> | |
<sphere translateY="2.98" scaleX="0.23" scaleY="0.23" translateX="0.00"/> | |
<sphere translateY="2.70" scaleX="0.23" scaleY="0.23" translateX="0.38"/> |
OlderNewer