Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View daniel-williams's full-sized avatar

Daniel Williams daniel-williams

  • Seattle, WA
View GitHub Profile
@daniel-williams
daniel-williams / fibonacci.js
Created April 6, 2015 20:16
Fibonacci using recursive JavaScript
function fib(n,undefined){
if(fib.cache[n] === undefined)
fib.cache[n] = fib(n-1) + fib(n-2);
return fib.cache[n];
}
fib.cache = [0,1,1];
fib(10);
console.log(fib.cache);
@daniel-williams
daniel-williams / generic-event-handler.js
Last active August 29, 2015 14:18
Javascript Events
function (ev) {
e = ev || window.event;
var target = e.target || e.srcElement;
// have fun here
// cancel bubbling?
e.cancelBubble = true;
if(e.stopPropagation) {
e.stopPropagation();
for (var attrname in obj2) { obj1[attrname] = obj2[attrname]; }
// smashless version
/**
* Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1
* @param obj1
* @param obj2
* @returns obj3 a new object based on obj1 and obj2
*/
function merge_options(obj1,obj2){
npm install --save-dev gulp gulp-cli gulp-concat gulp-jshint gulp-less gulp-load-plugins gulp-minify-css gulp-rename gulp-uglify
@daniel-williams
daniel-williams / React.Comp.Tmpl.js
Last active August 29, 2015 14:25
React Component Template
var _debug = true;
var XXXXXX = React.createClass({
displayName: 'XXXXXX',
// Mixins
mixins: [],
// Props
propTypes: {
<link rel="stylesheet" href="//code.cdn.mozilla.net/fonts/fira.css">
@daniel-williams
daniel-williams / ComposeAndSequence
Created October 27, 2015 00:57
Compose and Sequence
var compose = function () {
var fns = arguments;
return function (result) {
for (var i = fns.length - 1; i > -1; i--) {
result = fns[i].call(this, result);
}
return result;
};
@daniel-williams
daniel-williams / Delete remote branch
Last active November 26, 2016 22:19
Gokking the Git
# deletes the local remote-tracking branch, but not the actual remote branch
git branch -rd origin/[branch name]
# To delete the actual remote branch
git push origin --delete [branch name]
{
"always-semicolon": true,
"block-indent": 2,
"color-case": "lower",
"color-shorthand": false,
"quotes": "single",
"space-after-colon": 1,
"space-before-opening-brace": 1,
"space-after-opening-brace": "\n",
"space-before-selector-delimiter": 0,
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+shift+\\", "command": "workbench.action.splitEditor" },
{ "key": "ctrl+\\", "command": "workbench.action.toggleSidebarVisibility" },
{ "key": "ctrl+shift+c", "command": "csscomb.execute" },
{ "key": "ctrl+n", "command": "workbench.action.files.newFile" },
{ "key": "ctrl+shift+n", "command": "workbench.action.files.newFolder" }
]