Skip to content

Instantly share code, notes, and snippets.

View wjlroe's full-sized avatar
📷

William Roe wjlroe

📷
View GitHub Profile
@scrooloose
scrooloose / chef.vim
Last active December 12, 2015 07:38 — forked from dougireton/chef.vim
function! SyntaxCheckers_chef_foodcritic_IsAvailable()
return executable('foodcritic')
endfunction
function! SyntaxCheckers_chef_foodcritic_GetLocList()
" let exe = expand(g:syntastic_ruby_exec)
" if !has('win32')
" let exe = 'RUBYOPT= ' . exe
" endif
require 'connection_pool'
require 'redis'
require 'metriks'
class RedisClientWrapper
def initialize(options)
@options = options.delete(:pool)
@pool = ConnectionPool.new(@options) do
::Redis.new(options)
end
@toranb
toranb / half_baked_pagination.js
Created January 1, 2013 23:59
A half baked ember.js pagination solution using the v2 router api
PersonApp = Ember.Application.create();
PersonApp.SearchField = Ember.TextField.extend({
keyUp: function(e) {
var search = this.get('value');
this.get('controller.target').send('searchUsers', {match:search});
}
});
PersonApp.PersonView = Ember.View.extend({
templateName: 'person',
@sleeptillseven
sleeptillseven / erlang_vm.md
Last active July 18, 2016 13:44
Collection of interesting resources for studying the Erlang VM

List of Interesting Resources Describing the Erlang VM

Hitchhiker's guide to the Erlang VM

Author: Robert Virding (Co-inventor of Erlang)

Slides: pdf

Video: youtube

@mebens
mebens / gist:3929259
Created October 22, 2012 02:07
Generate a linear radial gradient in Love2D
local function scale(x, min1, max1, min2, max2)
return min2 + ((x - min1) / (max1 - min1)) * (max2 - min2)
end
local function distance(x1, y1, x2, y2)
return math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2)
end
function radialGradient(radius)
local data = love.image.newImageData(radius * 2, radius * 2)
@toranb
toranb / filtersortpagemixin.js
Created September 24, 2012 02:37
filter/sort/pagination mixin for ember.js
var get = Ember.get;
/**
* @extends Ember.Mixin
*
* Implements common filter / sort / pagination behavior for array controllers
* */
Ember.FilterSortSliceMixin = Ember.Mixin.create({
filterBy: '',
@maccman
maccman / juggernaut.rb
Created June 26, 2012 02:49
Sinatra Server Side Event streaming.
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@buritica
buritica / iosd
Created March 29, 2012 18:52
Enable Remote Inspector on Mobile Safari
#!/bin/bash
# Open iPhone Simulator on default location for XCode 4.3 if found
[[ -d /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/ ]] &&
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
# Open iPhone Simulator on default location for XCode 4.2 if found
[[ -d /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/ ]] &&
open /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
@tlync
tlync / gist:1992497
Created March 7, 2012 10:54
Reload a web page on iPhone Simulator (elisp)
(defun web-reload-iphonesimulator ()
"Reload a page on iPhone Simulator. Run process associated to the *Messages* buffer"
(interactive)
(start-process-shell-command
"iphonesimulator-process"
"*Messages*"
"osascript -e 'tell application \"System Events\"' -e 'tell process \"iPhone Simulator\"' -e 'click button \"Reload\" of window 1' -e 'end tell' -e 'end tell'"))
@seancribbs
seancribbs / xmlsimple.erl
Created February 27, 2012 20:18
Module to simplify XML reading/manipulation stuffs in Erlang
%% @doc Uses SAX to convert an XML document into a simple nested-tuple
%% structure. Ignores namespaces.
-module(xmlsimple).
-export([file/1,
string/1,
emit/1,
emit_file/2]).
-include_lib("xmerl/include/xmerl.hrl").