Skip to content

Instantly share code, notes, and snippets.

View finbarr's full-sized avatar

Finbarr Taylor finbarr

View GitHub Profile
@finbarr
finbarr / smarter_changed.rb
Created December 23, 2017 00:44
SmarterChanged
module SmarterChanged
extend ActiveSupport::Concern
def changed?
cache = Thread.current[:smarter_changed]
wipe = false
if cache.nil?
cache = Thread.current[:smarter_changed] = {}
wipe = true

Keybase proof

I hereby claim:

  • I am finbarr on github.
  • I am finbarr (https://keybase.io/finbarr) on keybase.
  • I have a public key ASAtKB5TBoeJO7S5dYi4m849itksa1MtDZPM2SXER5D_8wo

To claim this, I am signing this object:

@finbarr
finbarr / .bashrc
Created January 17, 2017 22:59
Bash shortcuts
alias g="git"
alias gs="git status"
alias gl="git log"
alias ga="git add ."
alias gb="git branch"
alias gf="git fetch"
alias gfu="git fetch upstream"
alias gd="git diff"
alias gr="git rebase"
alias gm="git merge"
@finbarr
finbarr / paste.html
Last active November 9, 2016 15:12
HTML
<div>
<h4>Sure of what you need? Just Click your Brand</h4>
<div class="social">
<a href="https://mytoolkit.co.uk/collections/josef-kihlberg" target="_blank">
<img src="https://cdn.shopify.com/s/files/1/1038/3444/files/kihlberg-175-logo.png?15980725253915264262" alt="Our range of Josef Kihlberg staplers">
</a>
<a href="https://mytoolkit.co.uk/collections/stanley-bostitch" target="_blank">
<img src="https://cdn.shopify.com/s/files/1/1038/3444/files/bostitch-logo.jpg?15980725253915264262" alt="Our range of Stanley Bostitch staplers and nail guns">
</a>
@finbarr
finbarr / routes.rb
Created September 27, 2016 20:26
routes.rb
resources :campaigns do
collection do
get :customer_count
end
end
class SegmentService
def self.safe_method(name, &blk)
define_method name do |*args|
begin
instance_exec *args, &blk
rescue
Rails.logger.info "Rescued #{name}"
end
end
end
@finbarr
finbarr / toot.rb
Created September 8, 2016 03:55
Toot
class Toot < ActiveRecord::Base
after_commit :foo
validate :never
def never
self.errors[:base] << 'wtfff'
false
end
@finbarr
finbarr / st3.json
Created February 15, 2016 06:39
Sublime Text 3 preferences
{
"always_show_minimap_viewport": true,
"animation_enabled": false,
"auto_complete_commit_on_tab": true,
"auto_complete_cycle": true,
"auto_complete_delay": 0,
"auto_complete_with_fields": true,
"bold_folder_labels": true,
"caret_extra_bottom": 0,
"caret_extra_top": 0,
@finbarr
finbarr / pref.json
Created October 23, 2013 22:40
Sublime Text 2 Preferences
{
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 0,
"bold_folder_labels": true,
"caret_style": "wide",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
alias ll="ls -al"
alias gch="git checkout"
alias gb="git branch"
alias gs="git status"
alias gp="git pull"
alias gf="git fetch"
alias gr="git rebase"
alias gl="git log"
alias gd="git diff"
alias gdo="git diff origin/master"