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 / nginx-cors.conf
Last active March 10, 2016 01:12 — forked from algal/nginx-cors.conf
Nginx CORS include file
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests
# - Access-Control-Max-Age=20days, to minimize repetitive OPTIONS requests
@surjikal
surjikal / sublime-config.json
Created January 10, 2014 04:55
sublime config
{
"binary_file_patterns":
[
"*.scssc"
],
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"drag_text": false,
"file_exclude_patterns":
[
@surjikal
surjikal / range-parser.coffee
Created December 30, 2013 22:36
Some date range parser, a bit like elastic search.
###
unused, but cool
###
parseRange = do ->
isInfinity = (x) ->
x is Number.NEGATIVE_INFINITY or \
x is Number.POSITIVE_INFINITY or
/\-?infinity/i.test x
@surjikal
surjikal / postgres.rb
Created December 30, 2013 19:43
Postgres 9.3.2 homebrew recipe with nested hstore patch
require 'formula'
class Postgresql < Formula
homepage 'http://www.postgresql.org/'
url 'http://ftp.postgresql.org/pub/source/v9.3.2/postgresql-9.3.2.tar.bz2'
sha256 '700da51a71857e092f6af1c85fcd86b46d7d5cd2f2ba343cafb1f206c20232d7'
bottle do
sha1 '106eb209038abdaa2cad8d91d2a422404f8fbe56' => :mavericks
sha1 '283c27e518a789d2cd57640375be00e18c829ef4' => :mountain_lion
diff --git a/contrib/hstore/.gitignore b/contrib/hstore/.gitignore
index 5dcb3ff..b84aac6 100644
--- a/contrib/hstore/.gitignore
+++ b/contrib/hstore/.gitignore
@@ -2,3 +2,6 @@
/log/
/results/
/tmp_check/
+/hstore_gram.c
+/hstore_gram.h
@surjikal
surjikal / OAuth.cls
Created November 19, 2013 03:18
Apex 2-legged OAuth 1.0
public class OAuth {
public static HttpRequest signRequest(HttpRequest req, String consumerKey, String consumerSecret) {
String nonce = String.valueOf(Crypto.getRandomLong());
String timestamp = String.valueOf(DateTime.now().getTime() / 1000);
Map<String,String> parameters = new Map<String,String>();
parameters.put('oauth_signature_method','HMAC-SHA1');
parameters.put('oauth_consumer_key', consumerKey);
parameters.put('oauth_timestamp', timestamp);
isType = do ->
getType = (x) -> x.constructor.name
[[],{}].reduce ((result, x) ->
type = getType(x)
result[type] = (y) -> getType(y) is type
),{}
@surjikal
surjikal / prediction-io-ubuntu-precise.md
Last active March 24, 2017 11:33
Prediction IO Install Notes on Ubuntu Precise (12.04)