Skip to content

Instantly share code, notes, and snippets.

View surjikal's full-sized avatar
👁️‍🗨️

Nick Porter surjikal

👁️‍🗨️
  • CTO @ 42
  • Oakland
View GitHub Profile
@surjikal
surjikal / decorators.js
Created October 23, 2012 16:44
Javascript Tests
function decorator(fn) {
function wrapper() {
console.log('Before function.');
var ret = fn.apply(this, arguments);
console.log('After function.');
return ret;
}
return wrapper;
@surjikal
surjikal / fetch-libs.sh
Created November 11, 2012 11:12
Fetch client-side dependencies for a static site
#!/bin/sh
LIBS_DIR="./src/scripts/libs"
COLOR_RED="\033[0;31m"
COLOR_PURPLE="\033[0;35m"
COLOR_BRIGHT_PURPLE="\033[1;35m"
COLOR_GREEN="\033[0;32m"
COLOR_RESET="\033[0m"
@surjikal
surjikal / ia-writer.css
Created November 23, 2012 05:30
iA Writer style headers
body {
font-family: monospace;
width: 600px;
margin: 0 auto;
}
h1,
h2,
h3 {
line-height: 2em;
@surjikal
surjikal / README.md
Last active October 13, 2015 19:08 — forked from agnoster/README.md
My ZSH Theme

surj.zsh-theme

This is a hack of this awesome theme by agnoster.

The same instructions apply:

  • You'll probably need to install a Powerline-patched font for this theme to render correctly.
  • Optimized for iTerm2, using a modified version of the Solarized Theme (included at the bottom of this gist).
@surjikal
surjikal / postgres-cheat-sheet.md
Last active December 9, 2015 21:58
Postgres cheat sheet.

Default port: 5432

To log in (as root)...
psql -d template1 -U postgres

Commands

The prompt should be: template1=#

@surjikal
surjikal / wiki.go
Created February 25, 2013 21:42
Trying out the Go language. http://golang.org/doc/articles/wiki/
package main
import (
"fmt"
"io/ioutil"
)
type Page struct {
Title string
Body []byte
@surjikal
surjikal / main.scss
Last active December 14, 2015 08:59
Single Page Mobile Web Apps - Layout
@import "mixins";
$header-height: 50px;
$footer-height: 60px;
html, body {
width: 100%;
height: 100%;
}
@surjikal
surjikal / hsl-cycler.coffee
Created March 11, 2013 00:59
This gist demonstrates a way to cycle the color of a set of elements
cycleHue = (interval, increment, hue, callback) ->
cycle = ->
hue = (hue + increment) % 360
callback hue
setInterval cycle, interval
# To use it...
# Ex: Increment degree by 1 every 100 ms, starting at 120 degrees
@surjikal
surjikal / _functions.scss
Created March 20, 2013 18:28
SASS/Compass mixins and functions that I created or found
// Adapted from equation here:
// http://stackoverflow.com/questions/746899/how-to-calculate-an-rgb-colour-by-specifying-an-alpha-blending-amount
//
// Use this as a generator, i.e. do something like this:
//
// $background-color: #424242;
//
// @function fake-rgba($color, $alpha) {
// @return _fake-rgba($background-color, $color, $alpha);
// }
@surjikal
surjikal / fib-generator.js
Last active December 16, 2015 02:19
A fibonacci generator in JavaScript, because why not.
// Ex.
// fib = new FibonacciGenerator();
// for (var i = 0; i < 10; i++)
// console.log( fib.next() );
var FibonacciGenerator = function(prev, curr) {
var prev = parseInt(prev) || 0
, curr = parseInt(curr) || 1;
var next = function(oldPrev, oldCurr) {