This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
######## | |
################ | |
######### ########## | |
##### ###### | |
#### ##### | |
##### | |
####### | |
####### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _ _ _ | |
# | |__ __ _| |__ _ _ _ __ ___ __| | | |
# | '_ \/ _` | / _` | ' \/ _/ -_) _` | | |
# |_.__/\__,_|_\__,_|_||_\__\___\__,_| | |
# __ _ _ __| |_ ___ _ __ ___ _ _ | |
# / _| || (_-< _/ _ \ ' \/ -_) '_| | |
# \__|\_,_/__/\__\___/_|_|_\___|_| | |
# | |
# (c) 2013 stephan.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# by: _ _ | |
# __| |_ ___ _ __| |_ __ _ _ _ __ ___ _ __ | |
# (_-< _/ -_) '_ \ ' \/ _` | ' \ _/ _/ _ \ ' \ | |
# /__/\__\___| .__/_||_\__,_|_||_(_)__\___/_|_|_| | |
# |_| stephan@stephan.com | |
# Unobtrusive txtRotate | |
# http://codepen.io/stephancom/details/pgXypp/ | |
# applies to all elements with data-rotate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# by: _ _ | |
# __| |_ ___ _ __| |_ __ _ _ _ __ ___ _ __ | |
# (_-< _/ -_) '_ \ ' \/ _` | ' \ _/ _/ _ \ ' \ | |
# /__/\__\___| .__/_||_\__,_|_||_(_)__\___/_|_|_| | |
# |_| stephan@stephan.com | |
# unobtrusive preloader | |
# applies to all elements with data-preload | |
# expects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fizzbuzz benchmark - comparing different versions of the classic | |
# stephan.com | |
require 'rspec' | |
require 'benchmark' | |
require 'formatador' | |
# suppress output | |
def no_stdout | |
ostd = $stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Returns keys from a hash recursively when that hash can contain hashes | |
# Handy for use with StrongParameters | |
recurse_keys = lambda do |h| h.inject([]) { |a, (k, v)| a << (v.is_a?(Hash) ? { k => recurse_keys.call(v) } : k) } rescue [] end | |
# Example | |
parms = {:foo=>:bar, :baz=>{:a=>:b, :c=>:d, :e=>:f}} | |
recurse_keys.call(parms) | |
# returns [:foo, {baz: [:a, :b, :c]}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
describe '${1:model_name} collection' do | |
${2:pending 'needs tests'} | |
end | |
describe 'CRUD ${1:model_name}' do | |
describe 'create' do | |
${3:pending 'needs tests'} | |
end | |
describe 'read' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@resource.aasm.events.each do |event| | |
member_action event.name, method: :post do | |
resource.send(event) if resource.aasm.may_fire_event?(event.name) | |
end | |
action_item event, only: :show, if: -> { resource.aasm.may_fire_event?(event.name) } do | |
link_to event.name.capitalize, action: event.name, controller: :ties, method: :post | |
end | |
batch_action event.name do |ids| | |
klass = controller_name.classify.constantize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// _ | |
// | | | |
// ______ _| | __ _ ___ ________ ___ _ ___ | |
// |_ / _` | |/ _` |/ _ \______\ \ / / | | |/ _ \ | |
// / / (_| | | (_| | (_) | \ V /| |_| | __/ | |
// /___\__,_|_|\__, |\___/ \_/ \__,_|\___| | |
// __/ | | |
// |___/ by stephan@stephan.com | |
// | |
// a vue filter for zalgo text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// __ _ _ _ _ | |
// / _| (_) | | | | | |
// | |_| |_ _ __ | |_ _____ _| |_ ________ ___ _ ___ | |
// | _| | | '_ \| __/ _ \ \/ / __|______\ \ / / | | |/ _ \ | |
// | | | | | |_) | || __/> <| |_ \ V /| |_| | __/ | |
// |_| |_|_| .__/ \__\___/_/\_\\__| \_/ \__,_|\___| | |
// | | | |
// |_| by stephan@stephan.com | |
// | |
// a vue filter for fliptext |