Skip to content

Instantly share code, notes, and snippets.

app.directive('datetime', ['$timeout', function($timeout) {
'use strict';
var DATE_REGEXP_MAP = {
'/' : '[\\/]',
'-' : '[-]',
'.' : '[.]',
dd: '(0?[1-9]|[1-2][0-9]|3[0-1])\\b',
MM: '(0?[1-9]|1[0-2])\\b',
yyyy: '(\\d{4})\\b',
//adapted from https://github.com/mgcrea/angular-strap/blob/master/src/directives/datepicker.js
app.directive('datetime', ['$timeout', function($timeout) {
'use strict';
var DATE_REGEXP_MAP = {
'/' : '[\\/]',
'-' : '[-]',
'.' : '[.]',
dd: '(0?[1-9]|[1-2][0-9]|3[0-1])\\b',
MM: '(0?[1-9]|1[0-2])\\b',
//in main app.js
var auth = require('./lib/auth');
//...
app.use(auth.checkPermissions());
//in lib/auth.js
exports.checkPermissions = function() {
return function checkPermissions(err, req, res, next) {
//sometimes this simply never kicks in,
@grownseed
grownseed / HaibuInstall.md
Last active December 10, 2015 23:08
Installing Haibu for Node.js deployment

Haibu Install (CentOS)

Install Node/NPM

su - 
yum install openssl-devel gcc-c++
cd /usr/local/src
@grownseed
grownseed / prime.js
Created July 8, 2012 03:22
JavaScript Euler's sieve implementation for generating an array of prime numbers
/*
To return an array of all prime numbers below 1000:
primeRange(1000);
*/
function primeRange(max)
{
var max_sqrt = Math.sqrt(max),
range = [],
current = 0;
@grownseed
grownseed / open_source_quotes.md
Last active August 29, 2015 14:17
Quotes on Open Source

'Yes,' he said. 'But these things (the solutions to problems in solid geometry such as the duplication of the cube) do not seem to have been discovered yet.' 'There are two reasons for this,' I said. 'Because no city holds these things in honour, they are investigated in a feeble way, since they are difficult; and the investigators need an overseer, since they will not find the solutions without one. First, it is hard to get such an overseer, and second, even if one did, as things are now those who investigate these things would not obey him, because of their arrogance. If however a whole city, which did hold these things in honour, were to oversee them communally, the investigators would be obedient, and when these problems were investigated continually and with eagerness, their solutions would become apparent.'

Plato, The Republic

Take you a glass of water

Make it against the law

See how good the water tastes

@grownseed
grownseed / gist:6db346a4590ffe632090
Created May 12, 2014 20:18
atom-shell build error
ninja: Entering directory `out/Release'
[15/959] CXX obj/vendor/breakpad/src/client/linux/crash_generation/breakpad_client.crash_generation_client.o
FAILED: /usr/bin/clang++ -MMD -MF obj/vendor/breakpad/src/client/linux/crash_generation/breakpad_client.crash_generation_client.o.d -DCOMPONENT_BUILD -DGURL_DLL -DSKIA_DLL -DNDEBUG -DUSING_V8_SHARED -DWEBKIT_DLL -DUSE_X11 -I../../vendor/breakpad/src -I../../vendor/breakpad/src/client -I../../vendor/breakpad/src/third_party/linux/include -I../../vendor -I../../vendor/breakpad -g -Wno-empty-body -std=gnu++11 -std=gnu++11 -fno-rtti -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -c ../../vendor/breakpad/src/client/linux/crash_generation/crash_generation_client.cc -o obj/vendor/breakpad/src/client/linux/crash_generation/breakpad_client.crash_generation_client.o