Skip to content

Instantly share code, notes, and snippets.

@eric-hu
eric-hu / brew doctor output
Last active December 10, 2015 14:28
Brew doctor output for ec2-ami-tools bug
1.9.3-p286 Eric-Mac:~ erichu $ brew doctor
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
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
@eric-hu
eric-hu / jst2haml.sh
Created October 21, 2011 08:02
short shell script for converting jst.ejs files to jst.ejs.haml files for haml_assets
# bin/bash
# Converts jst.ejs files into jst.ejs.haml files
# Adapted from: http://shifteleven.com/articles/2008/06/08/converting-erb-to-haml-snippet
#
# Run this script from the root of your Rails project directory (or other language of your choice)
#
# It will output one line for each file it'll convert. Look the list over and verify that everything
# looks right. Once you're certain (I suggest doing a backup/git commit at this point), run:
#
# jst2haml | bash
@eric-hu
eric-hu / gist:1260329
Created October 3, 2011 21:39
Contents of `npm list`
nodepad@0.1.0 /home/eric/Desktop/Dropbox/nodejs/nodepad2/nodepad
├─┬ connect-mongodb@1.0.0
│ ├─┬ connect@1.5.1
│ │ ├── mime@1.2.4
│ │ └── qs@0.3.1
│ └── mongodb@0.9.6-7
├── connect-timeout@0.0.1
├─┬ express@2.4.6
│ ├── connect@1.7.1
│ ├── mime@1.2.4
@eric-hu
eric-hu / gist:1238863
Created September 24, 2011 02:11
Omniauth commit 351cee1 valid authentication config fails
Started GET "/auth/facebook?perms=email,offline_access" for 127.0.0.1 at Fri Sep 23 19:10:06 -0700 2011
Started GET "/auth/facebook/callback?code=AQCCccoRQU404n7X4IGJHX_PARNJcOzAZNKxgRi4XRUlmZocwRkfF_Eie3H1Ze415sEDfZWTOYLxeaBXPLLkIhiLHBtDs7CHi6RUfN0CMC9VY4pD-Mj9M0-9dAytaQyc6vUkeUmhgRtDlFE7yNwQmEJN__fIvetAIc9neeyGHTcjBg" for 127.0.0.1 at Fri Sep 23 19:10:07 -0700 2011
Started GET "/auth/failure?message=invalid_credentials" for 127.0.0.1 at Fri Sep 23 19:10:07 -0700 2011
Processing by AuthenticationsController#failure as HTML
Parameters: {"message"=>"invalid_credentials"}
@eric-hu
eric-hu / gist:1238559
Created September 23, 2011 22:06
Omniauth commit 351cee1 breaks server startup
/home/eric/.rvm/gems/ruby-1.8.7-p299@rails3/gems/oa-facebook-0.2.3/lib/omniauth/strategies/facebook/view_helper.rb:4: /home/eric/.rvm/gems/ruby-1.8.7-p299@rails3/bundler/gems/omniauth-351cee1c2e9e/oa-oauth/lib/omniauth/strategies/oauth2/facebook.rb:48: odd number list for Hash (SyntaxError)
...ssion['access_token'], { mode: :query, param_name: 'access_t...
^
/home/eric/.rvm/gems/ruby-1.8.7-p299@rails3/bundler/gems/omniauth-351cee1c2e9e/oa-oauth/lib/omniauth/strategies/oauth2/facebook.rb:48: syntax error, unexpected ':', expecting '}'
...ssion['access_token'], { mode: :query, param_name: 'access_t...
^
/home/eric/.rvm/gems/ruby-1.8.7-p299@rails3/bundler/gems/omniauth-351cee1c2e9e/oa-oauth/lib/omniauth/strategies/oauth2/facebook.rb:48: syntax error, unexpected '}', expecting kEND
...y, param_name: 'access_token'} )
^
/home/eric/.rvm/gems/ruby-1.8.7-p299@rails3/bundler/gems/omniauth-351cee1c2e9e/oa-oauth/lib/omniauth/strate
@eric-hu
eric-hu / 2011-08-23 bundle show
Created August 23, 2011 19:40
'bundle show' for rack-recaptcha test bug
1.9.2-p180@async-rails Eric-Ubuntu:~/Desktop/Dropbox/github-forks/rack-recaptcha eric (master) $ bundle show
Gems included by the bundle:
* bundler (1.0.15)
* fakeweb (1.3.0)
* json (1.5.3)
* rack (1.3.2)
* rack-recaptcha (0.6.2 9d1922d)
* rack-test (0.5.7)
* riot (0.12.4)
* rr (1.0.3)
@eric-hu
eric-hu / gist:1126066
Created August 4, 2011 19:54
Script for ~/.irbrc to enable SQL query output for Rails 3
extend_console 'rails3', defined?(ActiveSupport::Notifications), false do
$odd_or_even_queries = false
ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
$odd_or_even_queries = !$odd_or_even_queries
color = $odd_or_even_queries ? ANSI[:CYAN] : ANSI[:MAGENTA]
event = ActiveSupport::Notifications::Event.new(*args)
time = "%.1fms" % event.duration
name = event.payload[:name]
sql = event.payload[:sql].gsub("\n", " ").squeeze(" ")
puts " #{ANSI[:UNDERLINE]}#{color}#{name} (#{time})#{ANSI[:RESET]} #{sql}"
# the following line will cause this error in my controller
# @post = Post.includes(:user, :subtopic => :category).paginate(:page =>1, :order => 'categories.category_name ASC', :conditions => ["posts.flags_count < ?", Flag.flag_threshold])
Hirb Error: PGError: ERROR: column posts.users.display_name does not exist
LINE 1: ...s_count" AS t0_r7, "posts"."popularity" AS t0_r8, "posts"."u...
^
: SELECT "posts"."id" AS t0_r0, "posts"."post_content" AS t0_r1, "posts"."user_id" AS t0_r2, "posts"."subtopic_id" AS t0_r3, "posts"."created_at" AS t0_r4, "posts"."updated_at" AS t0_r5, "posts"."votes_count" AS t0_r6, "posts"."flags_count" AS t0_r7, "posts"."popularity" AS t0_r8, "posts"."users.display_name" AS t0_r9, "posts"."subtopics.name" AS t0_r10, "posts"."categories.category_name" AS t0_r11, "users"."id" AS t1_r0, "users"."email" AS t1_r1, "users"."encrypted_password" AS t1_r2, "users"."password_salt" AS t1_r3, "users"."reset_password_token" AS t1_r4, "
@eric-hu
eric-hu / gist:1090790
Created July 18, 2011 22:04
Rack-recaptcha 0.6.0 throws an ActionView Template error
undefined local variable or method `request' for #<ActionView::Helpers::FormBuilder:0x7fd39d2120f0> (ActionView::Template::Error)
/home/eric/.rvm/gems/ruby-1.8.7-p352@global/gems/rack-recaptcha-0.6.0/lib/rack/recaptcha/helpers.rb:37:in `recaptcha_tag'
./app/views/registrations/new.html.erb:19:in `_app_views_registrations_new_html_erb___1988303414_70273426200640_0'
/home/eric/.rvm/gems/ruby-1.8.7-p352@global/gems/actionpack-3.0.9/lib/action_view/helpers/capture_helper.rb:40:in `capture_without_haml'
/home/eric/.rvm/gems/ruby-1.8.7-p352@global/gems/actionpack-3.0.9/lib/action_view/helpers/capture_helper.rb:172:in `with_output_buffer_without_haml_xss'
/home/eric/.rvm/gems/ruby-1.8.7-p352@global/gems/haml-3.1.2/lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer'
/home/eric/.rvm/gems/ruby-1.8.7-p352@global/gems/actionpack-3.0.9/lib/action_view/helpers/capture_helper.rb:40:in `capture_without_haml'
/home/eric/.rvm/gems/ruby-1.8.7-p352@global/gems/haml-3.1.2/lib/haml/he
@eric-hu
eric-hu / gist:1090491
Created July 18, 2011 19:59
Texticle throws a syntax error, following RVM ruby interpreter version update
@ykiw-1.8.7 Eric-Ubuntu:~/Desktop/Dropbox/ykiw3 eric (master) $ rails s
/home/eric/.rvm/gems/ruby-1.8.7-p352@ykiw/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require': /home/eric/.rvm/gems/ruby-1.8.7-p352@ykiw/gems/texticle-2.0/lib/texticle.rb:44: syntax error, unexpected tIDENTIFIER, expecting tAMPER (SyntaxError)
__send__(method, *search_terms, exclusive)
^
/home/eric/.rvm/gems/ruby-1.8.7-p352@ykiw/gems/texticle-2.0/lib/texticle.rb:72: undefined (?...) sequence: /^search_by_(?<columns>[_a-zA-Z]\w*)$/
/home/eric/.rvm/gems/ruby-1.8.7-p352@ykiw/gems/texticle-2.0/lib/texticle.rb:80: undefined (?...) sequence: /^search_by_(?<columns>[_a-zA-Z]\w*)$/
from /home/eric/.rvm/gems/ruby-1.8.7-p352@ykiw/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require'
from /home/eric/.rvm/gems/ruby-1.8.7-p352@ykiw/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `each'
from /home/eric/.rvm/gems/ruby-1.8.7-p352@ykiw/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `re