Skip to content

Instantly share code, notes, and snippets.

@ibraheem4
ibraheem4 / postgres-brew.md
Last active April 25, 2024 08:55 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@gaearon
gaearon / slim-redux.js
Last active April 25, 2024 18:19
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@alexhawkins
alexhawkins / HashTable.js
Last active August 7, 2021 23:33
Correct Implementation of a Hash Table in JavaScript
var HashTable = function() {
this._storage = [];
this._count = 0;
this._limit = 8;
}
HashTable.prototype.insert = function(key, value) {
//create an index for our storage location by passing it through our hashing function
var index = this.hashFunc(key, this._limit);
@woonketwong
woonketwong / jugglingDBWithPostgres
Last active December 29, 2015 05:09
JugglingDB with Postgres
var q = require('q');
var Schema = require('jugglingdb').Schema;
var schema = new Schema('postgres', {
database: 'woonketwong',
username: 'woonketwong'
});
// The first argument to schema.define is the table
// and schema name. Do not use any capital letter
// in the table name because the database create table
@aaronmccall
aaronmccall / placeholder.js
Created January 4, 2011 22:45
shim for browsers that don't support the html5 placeholder attribute
setup_placeholders = (function() {
$.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) {
$.support.placeholder = true;
return function() {}
} else {
return function(){