View fibonacci.js
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);
View generic-event-handler.js
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();
View merge-arrays.js
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){
View gist:4d77162ac2819d74a5b7
npm install --save-dev gulp gulp-cli gulp-concat gulp-jshint gulp-less gulp-load-plugins gulp-minify-css gulp-rename gulp-uglify
View React.Comp.Tmpl.js
var _debug = true;
var XXXXXX = React.createClass({
displayName: 'XXXXXX',
// Mixins
mixins: [],
// Props
propTypes: {
View ComposeAndSequence
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;
};
View csscomb.json
{
"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,
View Delete remote branch
# 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]
View vs code keyboard shortcuts
// 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" }
]