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 / shopify.md
Created October 22, 2015 03:05
How to fix Shogun page layout on Shopify

Click Online Store > Themes > Click '…' on the right > Edit HTML/CSS > Add a new Template > Create a new template for ‘page’ called ‘shogun’

Change the text in the box to this only:

{{page.content}}

Hit save and that should fix your problem. Please let me know if you need any more help.

@finbarr
finbarr / curl_format.txt
Created September 26, 2015 03:39
Curl Format
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n