Skip to content

Instantly share code, notes, and snippets.

View danielevans's full-sized avatar

Daniel Evans danielevans

  • Anfract
  • Portland, OR
View GitHub Profile
@danielevans
danielevans / Gemfile
Last active August 29, 2015 13:56
Rails app with rails-api, inherited_resources, acitve_model_serializers and has_scope
source 'https://rubygems.org'
gem 'active_model_serializers'
gem 'has_scope'
gem 'inherited_resources', '~> 1.3'
gem 'kaminari'
gem 'rails', '4.0.2'
gem 'rails-api'
gem 'pg'
module_function
def MultiHash h
h.keys.each do |key|
if key.is_a? Array
key.each do |new_key|
h[new_key] = h[key]
end
h.delete key
end
gate@vorash:~ ✔Ξ uname -a
Darwin vorash.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
gate@vorash:~ ✔Ξ brew doctor
Warning: Setting DYLD_* vars can break dynamic linking.
Set variables:
DYLD_LIBRARY_PATH
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
$ bundle check
The Gemfile's dependencies are satisfied
$ bundle list
Gems included by the bundle:
* actionmailer (4.0.0)
* actionpack (4.0.0)
* active_model_serializers (0.8.1)
* activeadmin (0.6.1 9f6b030)
* activemodel (4.0.0)
* activerecord (4.0.0)
gate@vorash:~ ✔Ξ gem update passenger
Updating installed gems
Updating passenger
Fetching: passenger-4.0.21.gem (100%)
Building native extensions. This could take a while...
Successfully installed passenger-4.0.21
Parsing documentation for passenger-4.0.21
Installing ri documentation for passenger-4.0.21
Installing darkfish documentation for passenger-4.0.21
Gems updated: passenger
mkdir tmp_ps_inst
cd tmp_ps_inst
echo "source 'https://rubygems.org'\ngem 'passenger', git: '[email protected]:phusion/passenger.git'" > Gemfile
bundle install
bundle exec passenger-install-apache2-module
/Users/gate/personal/test_app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands/runner.rb:53:in `eval': `attr_accessible` is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add `protected_attributes` to your Gemfile to use old one. (RuntimeError)
from /Users/gate/personal/test_app/vendor/bundle/ruby/2.0.0/gems/songkick-oauth2-provider-0.10.2/lib/songkick/oauth2/model/authorization.rb:20:in `<class:Authorization>'
from /Users/gate/personal/test_app/vendor/bundle/ruby/2.0.0/gems/songkick-oauth2-provider-0.10.2/lib/songkick/oauth2/model/authorization.rb:5:in `<module:Model>'
from /Users/gate/personal/test_app/vendor/bundle/ruby/2.0.0/gems/songkick-oauth2-provider-0.10.2/lib/songkick/oauth2/model/authorization.rb:3:in `<module:OAuth2>'
from /Users/gate/personal/test_app/vendor/bundle/ruby/2.0.0/gems/songkick-oauth2-provider-0.10.2/lib/songkick/oauth2/model/authorization.rb:2:in `<module:Songkick>'
from /Users/gate/personal/test_app
ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/spec"
# require "mocha/setup"
# require "turn/autorun"
class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
@danielevans
danielevans / gist:6369355
Created August 28, 2013 18:16
Scan many rails log files for a particular query parameter for a particular action
require 'uri'
require 'csv'
i = 1
files = Dir.glob("app0*/*.log*")
data = files.map do |filename|
puts "Reading #{filename} #{i}/#{files.count}"
i = i + 1
File.readlines(filename).select do |line|
line.match /GET \"\/api\/image_search/
@danielevans
danielevans / gist:6004382
Created July 15, 2013 23:21
=> and this and == problem in coffeescript
_.each this.clips || [], (clip) =>
clip.selected = false
clip.selected = true if `clip.id == _this.model.clip_id`