Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / ec2-unbundle bug
Created January 3, 2013 21:43
ec2-unbundle error output
1.9.3-p286 Eric-Mac:~ erichu $ ec2-unbundle
/usr/local/Library/LinkedKegs/ec2-ami-tools/jars/lib/ec2/platform/current.rb:43:in `initialize': ["/usr/local/Library/LinkedKegs/ec2-ami-tools/jars/lib/ec2/platform/current.rb:53:in `<module:Platform>'", "/usr/local/Library/LinkedKegs/ec2-ami-tools/jars/lib/ec2/platform/current.rb:16:in `<module:EC2>'", "/usr/local/Library/LinkedKegs/ec2-ami-tools/jars/lib/ec2/platform/current.rb:15:in `<top (required)>'", "/Users/erichu/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'", "/Users/erichu/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'", "/usr/local/Library/LinkedKegs/ec2-ami-tools/jars/lib/ec2/amitools/unbundle.rb:14:in `<main>'"] (EC2::Platform::Unsupported)
from /usr/local/Library/LinkedKegs/ec2-ami-tools/jars/lib/ec2/platform/current.rb:53:in `<module:Platform>'
from /usr/local/Library/LinkedKegs/ec2-ami-tools/jars/lib/ec2/platform/current.rb:16:in `<module:EC2>'
f
@eric-hu
eric-hu / session_vim_error_log
Created February 6, 2013 01:52
session.vim :RestartVim error log
Searching for "autoload/xolox/misc/timer.vim" in "/Users/erichu/.vim,/Users/erichu/.vim/bundle/NERDcommenter,/Users/erichu/.vim/bundle/YouCompleteMe,/Users/erichu/.vim/bundle/fugitive,/Users/erichu/.vim/bundle/mustache.vim,/Users/erichu/.vim/bundle/nerdtree,/Users/erichu/.vim/bundle/tabular,/Users/erichu/.vim/bundle/vim-coffee-script,/Users/erichu/.vim/bundle/vim-haml,/Users/erichu/.vim/bundle/vim-jst,/Users/erichu/.vim/bundle/vim-powerline,/Users/erichu/.vim/bundle/vim-rails,/Users/erichu/.vim/bundle/vim-session,/Users/erichu/.vim/bundle/vim-surround,/Users/erichu/.vim/bundle/vimclojure,/usr/local/Cellar/macvim/7.3-66/MacVim.app/Contents/Resources/vim/vimfiles,/usr/local/Cellar/macvim/7.3-66/MacVim.app/Contents/Resources/vim/runtime,/usr/local/Cellar/macvim/7.3-66/MacVim.app/Contents/Resources/vim/vimfiles/after,/Users/erichu/.vim/bundle/tabular/after,/Users/erichu/.vim/bundle/vim-coffee-script/after,/Users/erichu/.vim/after"
Searching for "/Users/erichu/.vim/autoload/xolox/misc/timer.vim"
Searching for "/Us
@eric-hu
eric-hu / debugger_failing_tests.rb
Created May 24, 2013 18:42
rake test output of debugger gem
1) Failure: test_0001_must_display_current_backtrace_with_last_callstyle(Frame
Command::display backtrace with callstyle)
[/Users/erichu/Dropbox/ruby_apps/gem_development/debugger/lib/debugger/test/test_dsl.rb:94]:
Expected
["/Users/erichu/Dropbox/ruby_apps/gem_development/debugger/test/examples/frame.rb:3\n@should_break
= false", "", "[-2, 7] in
/Users/erichu/Dropbox/ruby_apps/gem_development/debugger/test/examples/frame.rb",
"1 debugger", "2", "=> 3 @should_break = false", "4", "5 t = Thread.new
do", "6 while !@should_break", "7 A.new.a", "Frame call-display style
is last", "Breakpoint 103 file
@eric-hu
eric-hu / more debugger output.rb
Created May 25, 2013 07:46
More "rake test" output for debugger #80
Run options: --seed 10083
# Running tests:
..............................................................S...........................S...................S...........SS.......................................SS...S.S....~> Console extensions: wirble hirb ap pm
.S......S.................F.FF.FFF...F.FF...F......................................................F...........................................................................S......S..............F.F..F.F..................F.
Finished tests in 1.732956s, 230.8195 tests/s, 249.2850 assertions/s.
1) Failure:
@eric-hu
eric-hu / invalid slim
Created July 21, 2013 03:59
Invalid slim file generated from erb2slim + devise
- - if controller_name != 'sessions'
= link_to "Sign in", new_session_path(resource_name)
br
- end -
- - if devise_mapping.registerable? && controller_name != 'registrations'
= link_to "Sign up", new_registration_path(resource_name)
br
- end -
- - if devise_mapping.recoverable? && controller_name != 'passwords'
= link_to "Forgot your password?", new_password_path(resource_name)
@eric-hu
eric-hu / TiDocs.sh
Created February 14, 2013 11:36
Getting offline version of Titanium mobile docs on Ubuntu
#! /bin/sh
# Run this from the folder you want to be the parent of your docs
# By default, generated docs go into
# titanium_mobile/dist/apidoc/ti_mobile_docs/
#
# This can be changed below
git clone https://github.com/appcelerator/titanium_mobile.git
cd titanium_mobile
sudo apt-get install python-setuptools python-dev
@eric-hu
eric-hu / erb2slim bug
Last active June 8, 2016 09:53
Steps to reproduce invalid slim code from fresh Rails/Devise install
rails new test_app
cd test_app
echo "gem 'devise', '~> 3.0.0'" >> Gemfile
bundle install
rails g devise:views
gem install html2slim
for file in app/views/devise/**/*.erb; do erb2slim $file ${file%erb}slim; done

Keybase proof

I hereby claim:

  • I am eric-hu on github.
  • I am cci_eric_hu (https://keybase.io/cci_eric_hu) on keybase.
  • I have a public key ASBg9AMrCHIevEvNhbc_TCm9-8TtfxFlStOKR_549jj2mgo

To claim this, I am signing this object: