Skip to content

Instantly share code, notes, and snippets.

View simeonwillbanks's full-sized avatar
☀️
😎

Simeon Willbanks simeonwillbanks

☀️
😎
View GitHub Profile
@simeonwillbanks
simeonwillbanks / form.html
Created February 7, 2014 22:00
Credit Card Form Tips via @forest
<input type="email" name="email" x-autocompletetype="email" autocomplete="email" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Email">
<input type="text" class="numberInput unknown" name="card_number" x-autocompletetype="cc-number" autocompletetype="cc-number" autocomplete="cc-number" placeholder="Card number">
<input type="tel" class="cvcInput" name="cc-csc" x-autocompletetype="cc-csc" autocompletetype="cc-csc" autocomplete="false" maxlength="4" placeholder="CVC">
# A sample Gemfile
source "https://rubygems.org"
gem "html-pipeline"
gem "github-markdown"
gem "github-linguist"
@simeonwillbanks
simeonwillbanks / barrier.rb
Created January 24, 2014 18:04
Create resource contention. http://rubygems.org/gems/barrier "barrier", "~> 1.0.0" #gem #ruby
require 'thread'
# A synchronization barrier enables multiple threads to wait until all threads
# have all reached a particular point of execution before any thread
# continues.
class Barrier
# Initialize new barrier. The _count_ argument specifies the number of threads
# that must call #wait before any of them successfully return from the call.
# The value specified by _count_ must be greater than zero.
@simeonwillbanks
simeonwillbanks / benchmark.rb
Last active January 3, 2016 07:19
Copy Hash #ruby #benchmark
require 'benchmark'
puts "\n\n"
puts RUBY_VERSION
iterations = 100_000
Benchmark.bmbm do |bm|
bm.report 'Hash#dup' do
WHITELIST1 = { :protocols => { :from => 'constant' } }
@simeonwillbanks
simeonwillbanks / .vimrc
Created January 10, 2014 16:21 — forked from robmiller/.vimrc
#writing #TechWordsToAvoid #vim
highlight TechWordsToAvoid ctermbg=red ctermfg=white
autocmd FileType markdown match TechWordsToAvoid /\c\<\(obviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however\|so,\|easy\)\>/
autocmd BufWinEnter *.md match TechWordsToAvoid /\c\<\(obviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however\|so,\|easy\)\>/
autocmd InsertEnter *.md match TechWordsToAvoid /\c\<\(obviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however\|so,\|easy\)\>/
autocmd InsertLeave *.md match TechWordsToAvoid /\c\<\(obviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however\|so,\|easy\)\>/
autocmd BufWinLeave *.md call clearmatches()
@simeonwillbanks
simeonwillbanks / byebye.sh
Created December 18, 2013 03:14
Kill development processes #bash #ruby
$ export BYEBYE=ruby
$ ps x | grep $BYEBYE | cut -d' ' -f1 | xargs kill -9
@simeonwillbanks
simeonwillbanks / bulk.sh
Created October 2, 2013 18:20
Redis Bulk Operations #redis #xargs #wc #unix
# Count all keys which match a wildcard from database 1
redis-cli -n 1 KEYS "foo:*" | wc -l
# Delete all keys which match a wildcard from database 1
redis-cli -n 1 KEYS "foo:*" | xargs redis-cli -n 1 DEL
@simeonwillbanks
simeonwillbanks / .git-config
Created September 26, 2013 16:41
Git diff binary files with Apache Tika #git #tika #diff
# .git/config
[diff "office"]
binary = true
textconv = /usr/bin/java -jar /usr/local/share/tika-app.jar --text
@simeonwillbanks
simeonwillbanks / nodes_presenter.rb
Last active December 23, 2015 14:09
Presenter < SimpleDelegator #ruby
class NodesPresenter < SimpleDelegator
def initialize(id_or_object)
@node = id_or_object.is_a?(Integer) ? NodeDecorator.find(id_or_object) : id_or_object.decorate
super @node
end
def ancestor(key)
NodesPresenter.new(@node.ancestor(key))
end
@simeonwillbanks
simeonwillbanks / .rspec
Created September 18, 2013 22:16
rspec-instafail integration #rspec #tdd #ruby
--colour --drb --require rspec/instafail --format RSpec::Instafail