Skip to content

Instantly share code, notes, and snippets.

View TheKidCoder's full-sized avatar
💚
Come Join Us @ Dutchie!

Chris Ostrowski TheKidCoder

💚
Come Join Us @ Dutchie!
View GitHub Profile
NoMethodError: undefined method `names' for nil:NilClass
…actionpack-4.2.9/lib/action_dispatch/journey/router.rb: 116:in `block in find_routes'
.org/jruby/RubyArray.java:2518:in `map!'(undefined
…actionpack-4.2.9/lib/action_dispatch/journey/router.rb: 113:in `find_routes'
…actionpack-4.2.9/lib/action_dispatch/journey/router.rb: 30:in `serve'
…ionpack-4.2.9/lib/action_dispatch/routing/route_set.rb: 817:in `call'
…/new_relic/agent/instrumentation/middleware_tracing.rb: 92:in `call'
…uby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb: 189:in `call!'
…uby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb: 167:in `call'
…/new_relic/agent/instrumentation/middleware_tracing.rb: 92:in `call'

Keybase proof

I hereby claim:

  • I am thekidcoder on github.
  • I am thekidcoder (https://keybase.io/thekidcoder) on keybase.
  • I have a public key ASBp94rsTbCK-x5jHwbMKWK1G386PIMDYBP2ztwWUeplvgo

To claim this, I am signing this object:

@TheKidCoder
TheKidCoder / test.rb
Created March 10, 2016 18:50
PostgreSQL load as JSON
require 'benchmark'
result = Benchmark.bm(7) do |x|
x.report("Arrays of JSON") do
ActiveRecord::Base.connection.execute(%{select row_to_json(prompts) as json from prompts order by id asc;}).to_a.each do |prompt|
Oj.load(prompt['json'])
end
end
x.report("Single JSON Object") do
Oj.load(ActiveRecord::Base.connection.execute(%{
class Thinger
def run!
[:first_thing, :second_thing, :third_thing].map do |meth_name|
begin
self.method(meth_name).call
rescue => e
puts "There was a problem running: #{meth_name}"
next
end
@TheKidCoder
TheKidCoder / base.rb
Last active August 29, 2015 14:20
Example Controller Service Object
module Workflows
class Base
attr_reader :errors
def self.call(*args)
new(*args).call
end
def initialize(params)
@params = __params(params)
@TheKidCoder
TheKidCoder / API ReadMe.md
Last active February 28, 2020 17:57
GeoTix Widget API V.1
           _                   __              
         /' `\                (  ~-_ /'        
       /'     )                    /`-__)      
     /'       ____     ____      /'     O.    ,
   /'   _   /'    )  /'    )-- /'     /'  \  / 
 /'    ' )/(___,/' /'    /'  /'     /'     \'  
(_____,/'(________(___,/'(,/(_,    (__ __/' \_ 
                                               
                                                                                    
@TheKidCoder
TheKidCoder / gist:b2488f1ba35a66f061ab
Created January 19, 2015 19:45
Use tap with ObjC & Java ruby inter-op.
def email_text_field
return @email_text_field if @email_text_field
@email_text_field = UITextField.alloc.initWithFrame([[0, 0], [225, 40]])
@email_text_field.center = CGPointMake(self.view.frame.size.width / 2, (self.view.frame.size.height / 2) - 60)
@email_text_field.placeholder = "tobias@funke.com"
@email_text_field.borderStyle = UITextBorderStyleRoundedRect
@email_text_field
end
@TheKidCoder
TheKidCoder / gist:d5c02b987af37b7fbafb
Created January 3, 2015 20:52
Simple method call cascading.
def title
[:full_name, :first_name, :name].find {|meth| object.respond_to?(meth)}.tap {|meth| return object.method(meth).call}
end
@TheKidCoder
TheKidCoder / gist:ddcc90ac9cd0f49bdd01
Last active August 29, 2015 14:04
Using PostgresLO with Jruby & JDBC.
connection = ActiveRecord::Base.connection.raw_connection
manager = connection.connection.getLargeObjectAPI
oid = nil
#Write To LO
ActiveRecord::Base.transaction do
oid = manager.createLO
puts oid
path = java.nio.file.Paths.get("/Users/chris/Desktop/SIA - Arkansas/CORE - SIA - AR - Core Application.pdf")
@TheKidCoder
TheKidCoder / database.rake
Created April 24, 2014 16:25
Rake task to make binary backups/restores using pg_dump/pg_restore. Mainly used for breaking data changes in dev.
namespace :db do
namespace :binary do
desc "Dump current database to db/dumps"
task :dump => :environment do
#Get current info for git.
current_git_branch = `git rev-parse --abbrev-ref HEAD`.strip.gsub('/', '_')
current_git_hash = `git rev-parse HEAD`.strip
#Load DB config.
db_config = Rails.application.config.database_configuration[Rails.env]