Skip to content

Instantly share code, notes, and snippets.

View ohall's full-sized avatar
🚀

Oakley Hall ohall

🚀
View GitHub Profile
; function findItem() { ;
; var item ;
; while(item_not_found) { ;
// search
; } ;
; return item ;
; } ;
; var item = findItem() ;
@michaelwoods
michaelwoods / scrum.sh
Created July 13, 2016 15:06
List last two working days of commits from git repos for scrum status.
#!/usr/bin/env bash
#place the git repo directories here, space delimited
PROJECTS=(~/Projects/foo ~/Projects/bar)
DOW=$(date +%w)
if [[ $DOW -eq 1 ]]; then #Monday
SINCE=4.days
else
SINCE=2.days
@subfuzion
subfuzion / node-assessement.md
Last active March 19, 2021 10:03
Node.js Assessment

A few questions for quickly assessing candidate's Node.js skill level

  1. Write a function that simulates an asynchronous I/O function call. The function should be called ping. It should accept one argument called delay that will determine how many seconds before the function will call back with a response (pong). If no argument is provided, it should call back immediately. If the argument is greater than 3, it should call back with an error.
function ping(delay, callback) {
 // if delay is not provided, it should default to 0
 if (typeof delay === 'function') {
   callback = delay;
   delay = 0;
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
@vasanthk
vasanthk / System Design.md
Last active November 1, 2025 23:09
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
function *foo(x) {
var y = 2 * (yield (x + 1));
var z = yield (y / 3);
return (x + y + z);
}
//this "instantiates" (not sure if this is correct??) the generator
//and returns an object with a `next` method
var it = foo( 5 );
@ivan-loh
ivan-loh / gist:ee0d96c3795e59244063
Last active March 3, 2021 13:26
Node.JS ( & pm2 ) Process Memory Limit
# Plain Ol' Node
node --max-old-space-size=1024 app.js # increase to 1gb
node --max-old-space-size=2048 app.js # increase to 2gb
node --max-old-space-size=3072 app.js # increase to 3gb
node --max-old-space-size=4096 app.js # increase to 4gb
node --max-old-space-size=5120 app.js # increase to 5gb
node --max-old-space-size=6144 app.js # increase to 6gb
# For pm2
pm2 start app.js --node-args="--max-old-space-size=1024" # increase to 1gb
@michaelwoods
michaelwoods / prepare-commit-msg.sh
Last active July 16, 2018 15:30 — forked from bartoszmajsak/prepare-commit-msg.sh
Regex matching of JIRA story keys to prepend git commits.
#!/bin/bash
STORY_KEY=$(git symbolic-ref --short HEAD | grep -Eo '^[a-zA-Z0-9]{3,}[-_][0-9]{1,5}' | awk '{sub(/_/, "-"); print toupper($0)}')
if [ -n "$STORY_KEY" ]; then
sed -i.bak -e "1s/^/[$STORY_KEY] /" $1
fi
@getify
getify / gist:661f707f05e2743d00d2
Created February 10, 2015 23:27
param spread helper
// thanks to @raganwald
function spread(fn) {
return Function.apply.bind( fn, null );
}
function foo(x,y,z) {
console.log(x,y,z);
}
function bar(fn) {