Skip to content

Instantly share code, notes, and snippets.

View alexspeller's full-sized avatar
🏁

Alex Speller alexspeller

🏁
View GitHub Profile
@alexspeller
alexspeller / gist:359031
Created April 7, 2010 15:43
config/initializers/delete_action.rb
# Implements the "missing action" route by default
# see http://thelucid.com/2010/03/15/rails-can-we-please-have-a-delete-action-by-default/
ActionController::Resources::Resource.class_eval do
def add_default_actions_with_delete_action
add_default_actions_without_delete_action
add_default_action(member_methods, :get, :delete)
end
alias_method_chain :add_default_actions, :delete_action
function parseXml(xml)
{
var i = -1;
var groupArray = new Array();
j$(xml).find("pic").each(function()
{
i++;
var name = "gallery/" + j$(this).find('name').text();
var thumb = "gallery/thumbs/" + j$(this).find('thumb').text();
var group = j$(this).find('group').text();
@alexspeller
alexspeller / hack.sh
Created March 31, 2012 11:35 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@alexspeller
alexspeller / one.rb
Created June 3, 2012 21:48
Ruby method scopes
def option
puts 'hello from option'
end
@alexspeller
alexspeller / parser.rb
Created September 1, 2012 23:10
Docopt Parselet proof of concept
require 'parslet'
class Docopt < Parslet::Parser
# ==========
# = Basics =
# ==========
# Simple Tokens
rule(:equals) { str('=') }
rule(:newline) { str("\n") }
@alexspeller
alexspeller / source_maps.rb
Created September 16, 2012 00:03
Coffeescript Source Maps in Rails
# config/initializers/source_maps.rb
if Rails.env.development?
require 'open3'
module CoffeeScript
class SourceMapError < StandardError; end;
class << self
def map_dir
# Moved to https://github.com/alexspeller/ember-query
@alexspeller
alexspeller / gist:5143497
Created March 12, 2013 14:48
Ember data 36d2e2a dist
// Last commit: 36d2e2a (2013-03-11 17:37:25 -0700)
(function() {
window.DS = Ember.Namespace.create({
// this one goes past 11
CURRENT_API_REVISION: 12
});
})();
{
"my_models": [
{
"id": 1,
"name": "model 1"
},
{
"id": 2,
"name": "model 2"
},
{
"my_models": [
{
"id": 1,
"name": "model 1"
},
{
"id": 2,
"name": "model 2"
},