Skip to content

Instantly share code, notes, and snippets.

View rewinfrey's full-sized avatar
🏄‍♂️
fix f = let x = f x in x

Rick Winfrey rewinfrey

🏄‍♂️
fix f = let x = f x in x
View GitHub Profile
@rewinfrey
rewinfrey / gist:4699452
Created February 2, 2013 21:56
vimrc for Ryan
" Maintained by Rick Winfrey " heavily borrowed from Vincent Driessen's .vimrc file: https://raw.github.com/nvie/vimrc/master/vimrc
" and http://stevelosh.com/blog/2010/09/coming-home-to-vim/#scratch
set nocompatible
call pathogen#infect()
call pathogen#helptags()
filetype off " force reloading *after* pathogen loaded
filetype plugin indent on " enable detection, plugins and indenting in one step
syntax on
@rewinfrey
rewinfrey / gist:4728295
Created February 7, 2013 03:53
self in a module is the same as self in a class (at the method level)
module IsSelf
def what_is_self?
puts "self = #{self.inspect}"
puts "self's class = #{self.class}"
end
end
class AClass
include IsSelf
def initialize
@rewinfrey
rewinfrey / gist:4741901
Created February 8, 2013 21:03
Sample Rakefile
$:.unshift File.expand_path('../lib/', __FILE__)
require 'ttt/setup'
require 'rake'
require 'rake/testtask'
desc "Running Core Lib specs"
task :lib_specs do
system 'bash -l -c "rvm use default"'
system('rspec spec')
end
class MyStruct
def self.new(*method_names, &block)
raise ArgumentError, "wrong number of arguments (0 for 1+)" if method_names.empty?
Class.new do
class_eval &block if block
include Enumerable
def initialize(*args)
@rewinfrey
rewinfrey / gist:5305609
Created April 3, 2013 21:39
Configuring mysql for VM
mysql -u root -p
mysql> use mysql;
mysql> create database empire;
mysql> grant all privileges on empire.* to ''@localhost;
mysql> flush privileges;
@rewinfrey
rewinfrey / gist:5357259
Last active December 16, 2015 01:39
Sample for how to look at ES through CURL
curl -XDELETE 'http://localhost:9200/watbro' && curl -XPUT 'localhost:9200/watbro' -d '{"settings":{"analysis": {"analyzer": {"state":{"type": "pattern","pattern":"\\s"}}}}}'
curl 'localhost:9200/watbro/_analyze?pretty=1&analyzer=state&filter=state_strip' -d 'Mountain Village, AK'
@rewinfrey
rewinfrey / gist:5392969
Created April 16, 2013 02:47
gem trouble on vm
sudo gem install debugger-ruby_core_source -v 1.1.6
bundle --deployment
@rewinfrey
rewinfrey / gist:5415906
Created April 18, 2013 20:21
watbro.coffee from myles
@buildForm: (options) ->
form = $("<form></form>")
form.attr('method', options.method)
form.attr('action', options.action)
form.attr('target', options.target)
csrf_token = $('meta[name=csrf-token]').attr('content')
csrf_param = $('meta[name=csrf-param]').attr('content')
options[csrf_param] = csrf_token
for key, value of options.params
input = $('<input></input>')
@rewinfrey
rewinfrey / gist:5715903
Created June 5, 2013 18:07
Running seeds one at a time:
bundle exec rails runner 'require "./db/fixtures/production_ready/007_city_zipcodes"'
@rewinfrey
rewinfrey / gist:5922860
Last active December 19, 2015 07:59
Creating a featured provider
role_name = "featured_provider"
role = Authorization::Role.create(name: "featured_provider")
role.add_permission!(:'account:provider:featured')
Authorization::Role.add_member_to_role(member, role_name)