Skip to content

Instantly share code, notes, and snippets.

View Jeff-Lewis's full-sized avatar

Jeff Lewis Jeff-Lewis

  • StreetConnect & SchoolBee
  • NYC
View GitHub Profile
@gudbergur
gudbergur / README.markdown
Created February 19, 2012 23:49
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@timoxley
timoxley / README.md
Created March 18, 2012 12:34
environment-aware nconf config with better defaults handling

nconf becomes environment aware.

In the following example we have settings for test, development and production environments. defaults is used where a value for that particular key is not supplied for the current environment.

{
  "test": {
    "url": "localhost"
  },
 "staging": {
@garth
garth / log.js
Created May 1, 2012 19:36
Wasted quite a bit of time today trying to get flatiron winston configured with custom levels and colors, so here's a working sample.
var winston = require('winston')
require('winston-mongodb')
// prepare some custom log levels
var customLevels = {
levels: {
debug: 0,
info: 1,
warning: 2,
error: 3
@cbumgard
cbumgard / date-util.js
Created December 11, 2012 01:03
Formatting dates/times in node.js using Olson timezones and moment.js. Converts server-side timestamps to the browser's timezone.
var moment = require('moment');
var tz = require('timezone/loaded');
var time = require('time');
module.exports = function() {
var strftime_format = '%F %T %z'; // used to convert a date into a normalized strftime format with timezone
var moment_format = 'YYYY-MM-DD HH:mm:ss zz'; // moment.js LDML format for parsing date strings
/**
* Convert a Javascript Date into node-time wrapper with the appropriate timezone.
@mjgil-gist
mjgil-gist / Git Aliases
Last active January 23, 2019 01:30 — forked from mjgil/Git Aliases
Git: Aliases
Taken from TJ Holowaychuk: http://tjholowaychuk.com/post/26904939933/git-extras-introduction-screencast
Added to ~/.bash_aliases
alias gd="git diff | subl"
alias ga="git add"
alias gaa="git add --all"
alias gbd="git branch -D"
alias gst="git status"
alias gca="git commit -a -m"
alias gm="git merge --no-ff"
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active July 4, 2024 13:00
Backend Architectures Keywords and References
@shevron
shevron / LICENSE
Last active April 28, 2020 02:28
Send EC2 instance memory usage stats to CloudWatch using boto and IAM Roles
Copyright (c) 2015, Shahar Evron
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
@joewagner
joewagner / catchVersionErr.js
Last active December 22, 2015 11:48
Helper function to catch version errors when trying to update an Array field in a mongoose Model
// --- Dependancies ---
var _ = require('underscore');
var mongoose = require('mongoose');
// Any function that makes an update to a mongoose model that has an Array field can
// use this to catch version errors, and retry the update at most two times
var catchVersionErr = function () {
var updateFunc, callback, context, args = _.toArray(arguments);
context = args.shift();
@gg7
gg7 / chromium-bookmark-folders.patch
Last active October 24, 2024 02:54
Increase the number of recently shown folders (5) in chromium when adding/modifying a bookmark
diff --git a/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc b/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc
index 88df062..5adbc2e 100644
--- a/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc
+++ b/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc
@@ -14,7 +14,7 @@
namespace {
// Max number of most recently used folders.
-const size_t kMaxMRUFolders = 5;
+const size_t kMaxMRUFolders = 20;
@max-mapper
max-mapper / readme.md
Last active August 8, 2016 18:45
simple 4mb buffer proxy benchmarks

simple 4mb buffer proxy benchmarks

the goal: to do fast virtual host routing, e.g. to have a single process on a machine listening on port 80 and proxying data based on HTTP Host to other non-port-80 web processes on the same machine

many people use nginx for this because nginx is faster than node is currently for data-heavy applications (see below)

about these benchmarks

they use the JS proxies from https://github.com/substack/bouncy/tree/master/bench