def start_timer
setTimeout(time_is_up, 2000)
end
def time_is_up
alert "Time's up!"
| # Cucumber Step | |
| Then /^I should see the link "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector| | |
| matching_link = nil | |
| with_scope(selector) do | |
| all('a').each do |link| | |
| matching_link = link if link.has_content?(text) | |
| end | |
| end | |
| assert matching_link != nil, "No matching link was found" | |
| end |
| # The current way to define and run a method in CoffeeScript: | |
| hello = (name) -> | |
| alert 'Hello ' + name | |
| hello 'Chris' | |
| # JavaScript output: | |
| var hello; |
| # Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences. | |
| # Instructions: | |
| # Go to TextMate > Preferences... | |
| # Click Advanced | |
| # Select Folder References | |
| # Replace the following: | |
| # File Pattern |
| # A minimally beautiful command prompt: | |
| # user: directory (branch): | |
| # Place this in ~/.bashrc | |
| export PS1="\u: \W"'$(__git_ps1 " (%s)")'": " | |
| # Place this is /etc/profile to ensure Terminal sources ~/.bashrc when it launches | |
| [ -r $HOME/.bashrc ] && source $HOME/.bashrc |
| // One of the biggest problems with Internet Explorer 6 and 7 is the lack of display:inline-block support. | |
| // I use inline-block all the time. It's very handy. I'm ready to bug test in IE and of course, the main CSS problems | |
| // are with inline-block. | |
| // Using Compass you can remove that pain. Compass has cross-browser support for inline-block. | |
| // Enjoy. | |
| @import "compass/css3/inline-block"; | |
| ul{ |
| # So you have a collection of records you want to display in rows of 3. | |
| # Use Enumerable's each_slice method: | |
| <%= content_tag :div, :class => :thumbs do %> | |
| <% @thumbs.each_slice(3) do |slice| %> | |
| <%= content_tag :div, :class => :thumbs_row do %> | |
| <% slice.each do |thumb| %> | |
| <%= render 'thumb' %> | |
| <% end %> |
| # Ok, I'm creating a paired down version of Has_Many_Polymorphs in Rails 3 and making use of Arel. A great way to learn! | |
| # Super simple setup: | |
| class Content < ActiveRecord::Base | |
| polly :parents => :posts, :children => [:images, :paragraphs, :quotes] | |
| end | |
| class Post < ActiveRecord::Base | |
| end |
| // # I've assumed you've downloaded and installed the Flash CS4/CS5 Project Panel update at: http://www.gskinner.com/blog/archives/2010/07/project_panel_u.html | |
| // # 1. Create this file in: /Users/{you}/Library/Application Support/Adobe/Flash CS4/en/Configuration/Commands | |
| // # 2. Then go to Flash => Keyboard Shortcuts... | |
| // # 3. Create your shortcut under the Commands menu, I use 'Cmd+Opt+P' | |
| function call_method(p_panelName, p_function, p_param){ | |
| l = fl.swfPanels.length; | |
| if (l == 0) return 'false'; | |
| for (i=0; i<l; i++){ |
| (From @wayneeseguin) | |
| This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set. | |
| ∴ rvm update --head | |
| # ((Open a new shell)) | |
| # If you do not already have the ruby interpreter installed, install it: | |
| ∴ rvm install 1.9.1 | |