Skip to content

Instantly share code, notes, and snippets.

@lsegal
lsegal / anagram.js
Last active December 28, 2017 23:46 — forked from stevepm/anagram.js
function anagram(word) {
var originalWord = wordObject(word);
return {
matches: function(wordArray) {
if (typeof wordArray === 'string'){
wordArray = Array.prototype.slice.call(arguments);
}
var wordMatches = [];
@lsegal
lsegal / config.ru
Last active August 29, 2015 13:58 — forked from anonymous/config.ru
require_relative 'boot'
db = Sequel.connect(ENV['DATABASE_URL'])
Urls.attach_db(db[:urls])
run UrlShortener
@lsegal
lsegal / aws-repl.rb
Last active December 6, 2018 16:59 — forked from mdub/aws-repl.rb
#!/usr/bin/env ruby
require 'aws-sdk'
require 'pry'
Pry.config.prompt = [proc { "AWS> " }, proc { "AWS| " }]
AWS.pry
require 'bundler'
Bundler.require(:default)
# Currency
#
# A transaction currency.
#
class Currency
@lsegal
lsegal / rubydoc_github_source_links.user.js
Created October 22, 2011 02:09 — forked from jrochkind/gist:1305162
add links to github from rubydoc.info docs in the 'github' area.
// Copyright 2007-2010 Wincent Colaiuta. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
module Callbacks
@@callbacks = {}
def has_callback_hook(name)
@@callbacks[name] = []
class_eval <<-CLASS
def #{name}_add block
@callbacks[#{name}] << block
end
require 'yard'
YARD::Parser::SourceParser.parse_string <<-eof
# ### HELPERS ###
# Generates the base job definition hash
#
# @param [Hash] p The sanitized params sent by the user
# @param [Symbol] verb The job verb (:get, :post, :delete, :put)