Skip to content

Instantly share code, notes, and snippets.

View koppen's full-sized avatar

Jakob Skjerning koppen

View GitHub Profile
1) MeetingsController GET show raises
Failure/Error: get :show, {:id => "not a real id"}
ActiveRecord::RecordNotFound:
Couldn't find Meeting with id=not a real id
# ./app/controllers/meetings_controller.rb:25:in `show'

Keybase proof

I hereby claim:

  • I am koppen on github.
  • I am mentalizer (https://keybase.io/mentalizer) on keybase.
  • I have a public key whose fingerprint is EE7E 4025 6674 BAD8 3883 B1BC 92C6 35F9 D27E A0C1

To claim this, I am signing this object:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
@koppen
koppen / Sample usage
Created May 15, 2015 11:24
Find methods that return a value given a receiver and arguments
$ ./find_method.rb "foo" "FOO"
"foo".upcase #=> "FOO"
"foo".swapcase #=> "FOO"
"foo".upcase! #=> "FOO"
"foo".swapcase! #=> "FOO"
$ ./find_method.rb 1 2
1.succ #=> 2
1.next #=> 2
TASK: [lesmyrmidons.mongodb | Include OS-specific variables.] *****************
ok: [app] => {"ansible_facts": {"mongodb_repository": "deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen", "url_apt_key": "http://keyserver.ubuntu.com/pks/lookup?op=get&search="}}
TASK: [lesmyrmidons.mongodb | RedHat | Install dependencies packages] *********
skipping: [app]
TASK: [lesmyrmidons.mongodb | RedHat | Add source sources] ********************
skipping: [app]
TASK: [lesmyrmidons.mongodb | RedHat | Install Packages] **********************
@koppen
koppen / gist:1704921
Created January 30, 2012 15:16
Placing a div with unknown height first in code, bottom of design
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
.wrapper {
background: yellow;
margin-left: auto;
margin-right: auto;
position: relative;
width: 50%;
@koppen
koppen / html_links_to_text_interceptor.rb
Created October 12, 2015 09:35
Convert HTML links to text in ActionMailer emails
@koppen
koppen / gist:6239099
Last active December 21, 2015 02:59
Columnizer
require 'minitest/autorun'
require 'minitest/pride'
class Columnizer
def initialize(elements)
@elements = elements
end
def columns(number_of_columns)
columns = create_columns(number_of_columns)
SELECT * FROM (SELECT * FROM unnest(string_to_array('janson morke nils', ' '))) a, (SELECT * FROM unnest(string_to_array('janson morke nils', ' '))) b;
@koppen
koppen / recreate_activerecord_models.rb
Last active June 24, 2016 08:14
Delayed::Job trickery
# Recreate ActiveRecord models from Delayed Job jobs.
# Ensure that we recreate the full model
ActiveRecord::Base.partial_updates = false
Delayed::Job.all.each do |job|
# Deserialize the Delayed Job handler. As we've been using the `.delay` syntax
# and no custom jobs, this returns a Delayed::PerformableMethod
pfm = YAML.load(job.handler)