Skip to content

Instantly share code, notes, and snippets.

View EppO's full-sized avatar

Florent Monbillard EppO

  • Montréal, QC, Canada
View GitHub Profile
@EppO
EppO / Gemfile
Last active August 29, 2015 14:06
complete Gemfile with fontawesome-rails and sprockets-rails
source 'https://rubygems.org'
ruby '2.1.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.6'
# Use PostgreSQL as the database for Active Record
gem 'pg'
## Assets
gem "sprockets-rails", "2.1.3"
@EppO
EppO / consoleoutput.rb
Created January 27, 2014 18:20
rolify callbacks
irb(main):001:0> f = Folk.first
Folk Load (0.2ms) SELECT "folks".* FROM "folks" ORDER BY "folks"."id" ASC LIMIT 1
=> #<Folk id: 1, email: "folk@rockandfolk.com", encrypted_password: "$2a$10$bBJsiFh52QCNi0enN57XeerS2M7Tx8TXWXOgO9xj9pS8...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: "2014-01-27 16:56:02", updated_at: "2014-01-27 16:56:02">
irb(main):002:0> f.add_role :staff
Role Load (0.2ms) SELECT "roles".* FROM "roles" WHERE "roles"."name" = 'staff' AND "roles"."resource_type" IS NULL AND "roles"."resource_id" IS NULL ORDER BY "roles"."id" ASC LIMIT 1
Role Exists (27.6ms) SELECT 1 AS one FROM "roles" INNER JOIN "folks_roles" ON "roles"."id" = "folks_roles"."role_id" WHERE "folks_roles"."folk_id" = ? AND "roles"."id" = 2 LIMIT 1 [["folk_id", 1]]
(0.2ms) SELECT "roles".id FROM "roles" INNER JOIN "folks_roles" ON "roles"."id" = "folks_ro
@EppO
EppO / brew doctor
Last active December 23, 2015 09:39
Error when installing wireshark using homebrew
$ brew doctor
Your system is ready to brew.
$ brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew
HEAD: 4f2f733bb54a1523e7f39fa6b5f0f8ddb925e5e7
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
@EppO
EppO / gist:4227865
Created December 6, 2012 20:07 — forked from mauriciopasquier/gist:4225871
rolify
# User model
class Usuario < ActiveRecord::Base
rolify :role_cname => 'Rol'
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
@EppO
EppO / gist:3873342
Created October 11, 2012 15:50
Format XML/JSON from command line
#XML
$ curl http://something/xml | xmllint —format -
#JSON
$ curl http://something/json | python -mjson.tool
@EppO
EppO / rbx 2.0 + rubygems 1.8.11
Created January 25, 2012 03:38
rbx bundle install using rubygems 1.8.12 & 1.8.15
$ rvm use rbx@rbgems1.8.11
Using /Users/florent/.rvm/gems/rbx-head with gemset rubygems-1.8.11
$ gem -v
1.8.11
$ ruby -v
rubinius 2.0.0dev (1.8.7 d1c8aa95 yyyy-mm-dd JI) [x86_64-apple-darwin11.2.0]
$ time bundle install
@EppO
EppO / sequel + fiveruns-memcache-client
Created October 19, 2009 13:12
trying to cache sequel models in memcached
$ sequel postgres://mylogin:mypasswd@localhost/bddtest
Your database is stored in DB...
>> require 'memcache'
=> true
>> MemCache
=> MemCache
>> MemCache::VERSION
=> "1.5.0.1"
>> CACHE = MemCache.new("localhost")
=> MemCache: 1 servers, 1 buckets, ns: nil, ro: false
@EppO
EppO / Ruby 1.8.7 MRI - ARCHFLAGS="-arch x86_64" gem install memcached
Created October 2, 2009 23:25
require 'memcached' error on SnowLeopard
# ruby bench.rb
/opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.3/lib/rlibmemcached.bundle: dlopen(/opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.3/lib/rlibmemcached.bundle, 9): Symbol not found: _memcached_free (LoadError)
Referenced from: /opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.3/lib/rlibmemcached.bundle
Expected in: flat namespace
in /opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.3/lib/rlibmemcached.bundle - /opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.3/lib/rlibmemcached.bundle
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.3/lib/memcached.rb:19
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from bench.rb:2