This is now an actual repo:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # app/models/ability.rb | |
| # All front end users are authorized using this class | |
| class Ability | |
| include CanCan::Ability | |
| def initialize(user) | |
| user ||= User.new | |
| can :read, :all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence | |
| " http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users | |
| if exists('$TMUX') | |
| let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
| let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
| else | |
| let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
| let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
| endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /**********************************************/ | |
| /* | |
| /* IR_Black Skin by Ben Truyman - 2011 | |
| /* | |
| /* Based on Todd Werth's IR_Black: | |
| /* http://blog.toddwerth.com/entries/2 | |
| /* | |
| /* Inspired by Darcy Clarke's blog post: | |
| /* http://darcyclarke.me/design/skin-your-chrome-inspector/ | |
| /* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add this to the end of your development.rb and add | |
| # | |
| # gem 'pry' | |
| # | |
| # to your Gemfile and run bundle to install. | |
| silence_warnings do | |
| begin | |
| require 'pry' | |
| IRB = Pry |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)
Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
Processing by HomeController#index as HTML
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # USAGE: Hash.from_xml:(YOUR_XML_STRING) | |
| require 'nokogiri' | |
| # modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297 | |
| class Hash | |
| class << self | |
| def from_xml(xml_io) | |
| begin | |
| result = Nokogiri::XML(xml_io) | |
| return { result.root.name.to_sym => xml_node_to_hash(result.root)} |
NewerOlder