Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jamesrwhite on github.
  • I am jamesrwhite (https://keybase.io/jamesrwhite) on keybase.
  • I have a public key ASBFULLdB5fpfNm4Z0wnJlwHyT2rbNIYMuAXvsxh3ZfCLwo

To claim this, I am signing this object:

@jamesrwhite
jamesrwhite / install.sh
Created September 20, 2015 00:14
minicron install
echo "TODO.."

Keybase proof

I hereby claim:

  • I am jamesrwhite on github.
  • I am jamesrwhite (https://keybase.io/jamesrwhite) on keybase.
  • I have a public key whose fingerprint is 2BF2 420B 8722 0471 75C8 8FC1 E7B7 F6FD DE0D F18D

To claim this, I am signing this object:

@jamesrwhite
jamesrwhite / faye_test.rb
Created February 7, 2014 14:28
Faye client issues
require 'faye'
require 'eventmachine'
EM.run do
client = Faye::Client.new('http://localhost:9292/faye', { timeout: 10 })
pub = client.publish('/test', 'yo')
pub.callback do
puts "message recieved"
@jamesrwhite
jamesrwhite / settings.py
Created October 10, 2013 13:32
Switching Django configs on Google App Engine
# Database configs, only one of those will be chosen based on the env
database_configs = {
'development': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'wina',
'USER': 'django',
'PASSWORD': 'password',
'HOST': '127.0.0.1',
'PORT': '3306',
},
@jamesrwhite
jamesrwhite / lazy.php
Last active December 17, 2015 23:48
Lazy Loading Class Properties via Closures
<?php
class view_abstract {
protected $_data = array();
public function __get($name) {
echo "Getting $name\n";
@jamesrwhite
jamesrwhite / app.js
Last active December 17, 2015 12:19
riak-js issue
// Dependencies
var http = require('http');
express = require('express'),
path = require('path'),
db = require('riak-js').getClient({ debug: true }),
app = express();
// All environments
app.set('port', process.env.PORT || 3000);
app.use(express.logger('dev'));
@jamesrwhite
jamesrwhite / gist:4573530
Created January 19, 2013 16:34
osx addhost
function addhost {
colour1="\e[34m" # Blue
colour2="\e[31m" # Red
sudo sh -c "echo '$2\t$1' >> /etc/hosts" # Append to the hosts file
dscacheutil -flushcache # Flush DNS
echo "\e[0mPointed $colour1$1 \e[0mto $colour2$2\e[0m"
}
@jamesrwhite
jamesrwhite / gist:4245135
Created December 9, 2012 14:18
cURL Headers
<?php
$curl = curl_init('http://123123123123123123123123213w.com');
curl_setopt_array($curl, array(
CURLOPT_HEADER => true,
CURLOPT_NOBODY => true,
CURLOPT_RETURNTRANSFER => true,
));
@jamesrwhite
jamesrwhite / gist:3884584
Created October 13, 2012 13:09
OSX nginx .bashrc/.zshrc function
function nginx() {
if test $# = 0 || test $1 = "start"
then
sudo nginx && echo "Success!"
# stop or reload
else