Skip to content

Instantly share code, notes, and snippets.

var choose = function(list){
return list[Math.floor(list.length * Math.random())];
};
var aHero = function(){
return choose(heroList);
};
var aDeed = function(){
return choose(deedList);
var treeMaker = function(value){
//tree code goes here!
var tree = Object.create(treeMaker.methods);
tree.value = value || null;
tree.children = [];
return tree;
};
//methods go here!
var nthFibonacci = function(n) {
// Your code here
return n < 2 ? n : nthFibonacci(n-1) + nthFibonacci(n-2);
};
var result = nthFibonacci(4)
{
"HarleyKwyn": [''shortly-hapi','famous2048', 'barista', 'GalaxyQuestWebsite', 'SSAASS']
}
@kwyn
kwyn / jsx.sublime-snippet
Created September 6, 2014 22:36
jsx autocomplete snippet for /** @jsx React.DOM */ declaration
<snippet>
<content><![CDATA[/** @jsx React.DOM */]]></content>
<tabTrigger>jsx</tabTrigger>
<scope>source.js</scope>
<description>jsx declerations</description>
</snippet>
@kwyn
kwyn / config.js
Last active August 29, 2015 14:10
var config = module.exports = {};
config.server = {
views: {
engines: {
jade: require('jade')
},
basePath: __dirname,
path: './templates',
partialsPath: './templates/partials',
function trigger (match, offset, func){
var trigger_height = $(match).offset().top + offset;
var element_height = $(match).height();
$(window).on('scroll-tick', function() {
var scrolltop = $(window).scrollTop();
if(scrolltop > trigger_height && scrolltop < trigger_height + element_height){
func();
}
});
}
@kwyn
kwyn / bloom.js
Created September 11, 2015 21:54
Bloom filter in JavaScript because reasons.
var BloomFilter;
(function(){
BloomFilter = function(length){
this._limit = length;
this._storage = makeStorage.call(this);
}
var makeStorage = function(){
var that = this;
  • Devote 90 minutes a day to "practice"
    • practice = working on something fun with a path
  • Build to learn not to use/finish
  • Seven Slotted Learning Todo List
    • Strict seven slots
    • When it's full and you want to add something remove something and place in a "someday" file in your digital notepad of choice
  • Manage anxiety by converting to apathy or control
  • Apathy to get things done and avoid dread
@kwyn
kwyn / NanoSpring_Script.awk
Created May 9, 2016 15:41
Carve a nanospring out of a 3d point file
BEGIN{
#define PI for program
PI=3.14159;
#define radius of spring form, helical body radius
r=6;
#define pitch
p=7;
b= p/(2*PI);
#define diameter of spring wire and radius, cross-sectional thickness
d=4;