Skip to content

Instantly share code, notes, and snippets.

View danielhutchinson's full-sized avatar

Daniel Hutchinson danielhutchinson

View GitHub Profile
@danielhutchinson
danielhutchinson / Unique ID Generator PostgreSQL
Created February 16, 2015 21:07
A uniqe ID generator for PostgreSQL (blatantly stolen from instagram)
CREATE OR REPLACE FUNCTION uniq_id(OUT result bigint) AS $$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
now_millis bigint;
shard_id int := 1;
BEGIN
SELECT nextval('global_id_seq')%1024 INTO seq_id;
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000) INTO now_millis;
@danielhutchinson
danielhutchinson / Atom Snippets
Last active August 29, 2015 14:19
Atom Snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@danielhutchinson
danielhutchinson / gulpfile.js
Created June 4, 2015 08:18
Gulp + React + Babel + Browserify
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var babelify = require('babelify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var scriptsDir = './app/scripts';
var buildDir = './app/build';
// npm install --save-dev webpack webpack-dev-server typescript ts-loader
// webpage.config.js
module.exports = {
entry: './main',
output: { filename: 'app.js' },
module: {
loaders: [
{
test: /.ts$/,
@danielhutchinson
danielhutchinson / .zshrc
Created November 24, 2019 11:54
.zshrc settings
# If you come from bash you might have to change your $PATH.
export PATH=/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/Dan/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes