Skip to content

Instantly share code, notes, and snippets.

View seeflanigan's full-sized avatar

Cory Flanigan seeflanigan

View GitHub Profile
@seeflanigan
seeflanigan / anagram.clj
Last active December 22, 2015 16:29 — forked from rjmcdonald83/anagram.rb
Anagram Solutions
(ns anagram
(:require [clojure.string :refer [lower-case split]]))
(defn- duplicate? [a b]
(= (lower-case a) (lower-case b)))
(defn- unique-candidates [source candidates]
(remove #(duplicate? % source) candidates))
(defn- canonicalize [word]
require 'sinatra'
get '/' do
@name = # GET GIST HERE!!!
erb :home
end
@seeflanigan
seeflanigan / player.rb
Last active December 20, 2015 09:09 — forked from Jimgerneer/gist:6105276
class Player
attr_accessor :warrior, :direction, :health, :hurt, :step
def initialize
self.direction = :backward
self.hurt = false
self.step = true
end
def play_turn(warrior)
@seeflanigan
seeflanigan / appusers.rb
Created May 3, 2012 04:56 — forked from kartikrustagi/appusers.rb
Auth using Sinatra-Warden
require 'openssl'
class AppUser < Sequel::Model(:AppUsers)
AppUser.unrestrict_primary_key
def self.authenticate(username, password)
#TODO: Store salt in config
puts "In Auth"
user = self.first(:username => username)
autocmd User Rails Rnavcommand config config -suffix.rb -default=environment
autocmd User Rails Rnavcommand fabricator spec/fabricators -glob=**/* -suffix=_fabricator.rb
autocmd User Rails Rnavcommand feature features -suffix=.feature -default=cucumber
autocmd User Rails Rnavcommand sass app/stylesheets -glob=**/* -suffix=.sass -default=main
autocmd User Rails Rnavcommand scss app/stylesheets -glob=**/* -suffix=.scss -default=style
autocmd User Rails Rnavcommand steps features/step_definitions -suffix=_steps.rb -default=web
let g:surround_{char2nr("l")} = "link_to \1text: \1, \2path:\2\r"
let g:surround_{char2nr("#")} = "#{\r}"
context "POST edit_subscriptions" do
setup do
fake_login
@user.subscriptions << Factory(:subscription)
@preference = Factory(:reminder_preference)
@user.reminder_preferences << @preference
post :edit_subscriptions, :id => @user.id, "#{@preferences.id}_email" => "on"
end
should "empty the users reminder preferences" do
@user.reload