Skip to content

Instantly share code, notes, and snippets.

require([
// the blah stuff
'blah', 'stuff', 'meh',
// the things
'thingy', 'one',
// quanTITIES
'another', 'something', 'otherthing',
@azder
azder / declarative-require-idea.js
Last active December 16, 2015 15:09
An idea for creating some kind of declarative require with Require.js
define(['require', 'underscore', 'mylib'], function(require, _, MYLIB) {
// ALWAYS use strict when writing scripts
'use strict';
var modules = {
"name1": "url1",
"name2": "path2",
"name3": "some/other/place/to/load/3",
"name4": "url4"
function Model(){
var data = {};
// accessor
this.data = function(name, value){
// null makes it a deleter
if(null === value) {
delete data[name];
return this;

ganked from unreadable scribd doc here: http://cleancoder.posterous.com/what-killed-waterfall-could-kill-agile

What Killed Waterfall could Kill Agile.

Robert C. Martin
20 Nov, 2010

In 1970 a software engineer named Dr. Winston W. Royce wrote a seminal paper entitled Managing the Development of Large Software Systems. This paper described the software process that Royce felt was appropriate for large-scale systems. As a designer for the Aerospace industry, he was uniquely qualified.

He began the paper by setting up a straw-man process to knock down. He described this naïve process as “grandiose”. He depicted it with a simple diagram on an early page of his paper. Then the paper methodically tears this “grandiose” process apart. In the end, Royce proposed a far more nuanced and insightful approach, leaving the reader to giggle at the silliness of the “grandiose” model.

@azder
azder / switcher
Last active February 18, 2019 00:23
No more switch statements in JS. Run the code here: http://jsfiddle.net/azder/tD2B8/
var s, switcher;
switcher = (function () {
// ALWAYS
'use strict';
var elvis = function (value, dfault) {
return (null === value || void 0 === value ? dfault : value);
};
@azder
azder / y.js
Created April 6, 2014 11:41
y combinator and the calculation of factorial(5)
// Y combinator
function y(le) {
return (function (f) {
return f(f);
}(
function (g) {
return le(function (x) {
return g(g)(x);
});
})
@azder
azder / cb-in
Created April 19, 2014 09:03 — forked from Gen2ly/cb-in
#!/bin/bash
# Copy file or pipe to Xorg clipboard
# Required program(s)
req_progs=(xclip)
for p in ${req_progs[@]}; do
hash "$p" 2>&- || \
{ echo >&2 " Required program \"$p\" not installed."; exit 1; }
done
function toArray(args) {
return [].slice.call(args);
}
function autocurry(fn) {
var len = fn.length;
var args = [];
return function next() {
args = args.concat(toArray(arguments));
return (args.length >= len) ?
@azder
azder / databases
Last active August 29, 2015 14:02
Databases
mysqldump -u USERNAME -pPASSWORD DBNAME > DBNAME.sql
mysqldump -uUSERNAME -p DBNAME | gzip > DBNAME-$(date +"%Y-%m-%d-%H-%M-%S").sql.gz
mysqldump --all-databases -uroot -p | gzip > mysql-alldbs-$(date +"%Y-%m-%d-%H-%M-%S").sql.gz
mongodump -dDBNAME -o DIRNAME
mongorestore --drop -d DBNAME DIRNAME/
navArray = function (name) {
return function (obj) {
var value = ob.nav(name)(obj);
if (is.nil(value)) {
return [];
}
if (is.array(value)) {
return value;
}
return [value];