Skip to content

Instantly share code, notes, and snippets.

View nateberkopec's full-sized avatar

Nate Berkopec nateberkopec

View GitHub Profile
  • Whip of Erebos
  • Spear of Heliod
  • Agent of the Fates
  • Ashen Rider
  • Boon Satyr
  • Champion of Stray Souls
  • Chromanticore
  • Eidolon of Countless Battles
  • Ephara, God of the Polis
  • Erebos, God of the Dead
fatal: protocol error: expected old/new/ref, got 'shallow 0334aa796da397827fd2e43eb4af3c4b9ac0dff0'
! Heroku Git error, please try again shortly.
! See http://status.heroku.com for current Heroku platform status.
! If the problem persists, please contact http://help.heroku.com and provide Request ID e1d65557-16d7-4608-9a02-f5eccb9911b9.
fatal: The remote end hung up unexpectedly
Fetching repository, done.
Counting objects: 37, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (26/26), done.
Writing objects: 100% (27/27), 2.60 KiB | 0 bytes/s, done.
Total 27 (delta 20), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Ruby app detected
-----> Compiling Ruby/Rails
@nateberkopec
nateberkopec / friction.md
Created December 12, 2013 18:34
Clausewitz, ON WAR, Chapter VII

Everything is very simple in war, but the simplest thing is difficult. These difficulties accumulate and produce a friction, which no man can imagine exactly who has not seen war. Suppose now a traveller, who, towards evening, expects to accomplish the two stages at the end of his day's journey, four or five leagues, with post horses, on the high road—it is nothing. He arrives now at the last station but one, finds no horses, or very bad ones; then a hilly country, bad roads; it is a dark night, and he is glad when, after a great deal of trouble, he reaches the next station, and finds there some miserable accommodation. So in war, through the influence of an infinity of petty circumstances, which cannot properly be described on paper, things disappoint us, and we fall short of the mark. A powerful iron will overcomes this friction, it crushes the obstacles, but certainly the machine along with them. We shall often meet with this result. Like an obelisk, towards which the principal streets of a place converge,

@nateberkopec
nateberkopec / fuckit.rb
Created December 6, 2013 12:55
fuckit.rb
module Rack
class Fuckit
def initialize(app)
@app = app
end
def call(env)
@app.call(env) rescue nil
class Subscription
belongs_to :gifter, :class_name => 'User', :foreign_key => :gifter_id
end
@user = User.first
Subscription.where(gifter: @user)
# ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column subscriptions.gifter does not exist
@nateberkopec
nateberkopec / gist:5716233
Last active April 2, 2019 08:20
round the world in seven whiskeys

round the world in seven whiskeys, if youve drank these seven you'll have an idea of what whiskeys can do. i've deliberately picked "extreme flavored" scotches rather than necessarily "good" ones, to ensure the maximum flavor range possible. there are better islays, speysides, ryes, etc, but my intention is to show the wide flavor of high end whiskies.

  1. islay - Laphroaig Triple Wood or Laphroaig cask strength
  2. speyside - glenlivet, glenfiddich, highland park, or macallan, aim for 15 year or above.
  3. wooded - Balvenie Caribbean Cask 14 year, or any scotch with wood in the name.
  4. rye - no good recommendation here, but try one.
  5. bourbon - heavily aged. Jefferson Select 18 year is avaiable in high-end bars in NYC.
  6. sherried - Bruichladdich Black Art or any of the Macallan sherries
  7. corn - essentially "double bourbon". not a lot of high end stuff, but try Hudson.
@nateberkopec
nateberkopec / gist:5714795
Last active January 6, 2020 17:33
Fixing your Nokogiri config
# IF NOKOGIRI 1.5.X OR LOWER
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew install libxslt
bundle config --global build.nokogiri "--with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2"
bundle
@nateberkopec
nateberkopec / delayed_job.rb
Created April 12, 2013 01:42
Comparison of top 3 Ruby background job systems on Ruby Toolbox
# DelayedJob
@user.delay.activate!(@device) # Delay any object
Notifier.delay.signup(@user) # Delay ActionMailer
#DelayedJob supports a number of ways to make methods async
def send_mailer
# Some other code
end
handle_asynchronously :send_mailer, :priority => 20
#Subscription has_one :user
#Order has_many :subscriptions
sub = Subscription.new(user: User.new)
order = Order.new
order.subscriptions += [sub]
# order.subscriptions.first.user == nil