Skip to content

Instantly share code, notes, and snippets.

View manuelmeurer's full-sized avatar
🤷‍♂️

Manuel Meurer manuelmeurer

🤷‍♂️
View GitHub Profile

Keybase proof

I hereby claim:

  • I am manuelmeurer on github.
  • I am manuelmeurer (https://keybase.io/manuelmeurer) on keybase.
  • I have a public key whose fingerprint is 8253 5CB1 5C09 0D6C 74A3 DFBC A616 76F5 2806 A868

To claim this, I am signing this object:

require 'spork'
Spork.prefork do
require 'sidekiq/testing'
require 'capybara/rails'
require 'capybara/rspec'
require 'draper/test/rspec_integration'
ENV['RAILS_ENV'] ||= 'test'
@manuelmeurer
manuelmeurer / sql
Last active December 10, 2015 01:58
Error when using RocketTag's tagged_with with ActiveRecord's include
SELECT "taggable_models".* FROM (SELECT count("tags"."id") AS tags_count, taggable_models.* FROM "taggable_models" INNER JOIN "taggings" ON "taggings"."taggable_id" = "taggable_models"."id" AND "taggings"."taggable_type" = 'TaggableModel' INNER JOIN "tags" ON "tags"."id" = "taggings"."tag_id" WHERE "tags"."name" IN ('foo') GROUP BY "taggable_models"."id", "taggable_models"."user_id", "taggable_models"."name", "taggable_models"."type", "taggable_models"."foo" ORDER BY tags_count desc) taggable_models
@manuelmeurer
manuelmeurer / gist:3723502
Created September 14, 2012 17:51
Completely flatten a hash
# From: http://www.samlown.com/en/recursive_lambdas_and_how_to_completely_flatten_a_hash_in_ruby
flatten = lambda do |r|
case r
when Hash
r.to_a.map { |v| flatten.call(v) }.flatten
when Array
r.flatten.map { |v| flatten.call(v) }
else
r
@manuelmeurer
manuelmeurer / init
Created August 11, 2012 16:59
Install and secure MySQL 5.5 from source with Sprinkle
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
# MySQL daemon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.
@manuelmeurer
manuelmeurer / storefront_stylesheet.rb
Created February 22, 2012 13:11
Storefront Stylesheet
# Usage in view:
# %style{ type: 'text/css' }
# = StorefrontStylesheet.new(@storefront).to_css
class StorefrontStylesheet
def styles
[].tap do |styles|
styles << %(header { background-color: #{@storefront.layout.header_bg_color}; })
styles << %(body { background-color: #{@storefront.layout.body_bg_color}; })
styles << %(footer { background-color: #{@storefront.layout.footer_bg_color}; })
@manuelmeurer
manuelmeurer / log file
Created January 25, 2012 17:22
Error when logging in with Devise 1.4.9 and Rails 3.2.0
Started POST "/login" for 93.205.77.103 at 2012-01-25 18:03:05 +0100
Processing by Admin::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"S721A0kGRl59UL86sEGqeKZfpzwnBn2HPlHdd6f5wUU=", "admin_user"=>{"email"=>"manuel.meurer@gmail.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Log in"}
AdminUser Load (0.4ms) SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`email` = 'manuel.meurer@gmail.com' LIMIT 1
(0.1ms) BEGIN
(0.3ms) UPDATE `admin_users` SET `last_sign_in_at` = '2012-01-25 17:02:45', `current_sign_in_at` = '2012-01-25 17:03:06', `last_sign_in_ip` = '93.205.77.103', `sign_in_count` = 185, `updated_at` = '2012-01-25 17:03:06' WHERE `admin_users`.`id` = 1
(2.4ms) COMMIT
Redirected by /home/rails/apps/showspace-staging/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.0/lib/action_controller/metal/responder.rb:135:in `redirect_to'
Redirected to http://admin.staging.show-space.com/
Completed 302 Found in 79ms (ActiveRecord: 0.0ms)
@manuelmeurer
manuelmeurer / Gemfile
Created December 1, 2011 11:06
Bundler error: invalid byte sequence in US-ASCII
source :rubygems
gem 'rails', '~> 3.1.3'
gem 'haml', '~> 3.1.2'
gem 'jquery-rails', '~> 1.0.13'
gem 'mysql2', '~> 0.3.7'
gem 'factory_girl_rails', '~> 1.3.0'
gem 'ffaker', '~> 1.8.1'
gem 'paperclip', '~> 2.4.0'
gem 'airbrake', '~> 3.0.2'
@manuelmeurer
manuelmeurer / gist:1340608
Created November 4, 2011 22:04
Error installing mechanize gem via hoe
23:02:43 (ruby-1.9.2-p290@rails-3.1) ~/apps gem list | grep hoe
hoe (2.12.3)
23:02:47 (ruby-1.9.2-p290@rails-3.1) ~/apps git clone git://github.com/tenderlove/mechanize.git
Initialized empty Git repository in /Users/manuel/apps/mechanize/.git/
remote: Counting objects: 6194, done.
remote: Compressing objects: 100% (2105/2105), done.
remote: Total 6194 (delta 4143), reused 6083 (delta 4050)
Receiving objects: 100% (6194/6194), 961.58 KiB | 318 KiB/s, done.
Resolving deltas: 100% (4143/4143), done.
23:02:57 (ruby-1.9.2-p290@rails-3.1) ~/apps cd mechanize
@manuelmeurer
manuelmeurer / Exception
Created September 20, 2011 20:11
Ohm error
NoMethodError: protected method `key_for' called for Activity:Class
# Stacktrace
lib/ohm_model_template.rb:65:in `method_missing'
[GEM_ROOT]/bundler/gems/ohm-870c88ac4614/lib/ohm.rb:741:in `union_key_for'
[GEM_ROOT]/bundler/gems/ohm-870c88ac4614/lib/ohm.rb:732:in `block (2 levels) in keys'
[GEM_ROOT]/bundler/gems/ohm-870c88ac4614/lib/ohm.rb:723:in `each'
[GEM_ROOT]/bundler/gems/ohm-870c88ac4614/lib/ohm.rb:723:in `block in keys'
[GEM_ROOT]/bundler/gems/ohm-870c88ac4614/lib/ohm.rb:722:in `tap'