- Detailed Cheatsheet: http://danielkummer.github.io/git-flow-cheatsheet/
- Command-line Arguments Reference: https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
- git-flow Home: https://github.com/nvie/gitflow
RSpec.configure do |config| | |
config.before(:suite) do | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before(:each) do | |
DatabaseCleaner.strategy = :transaction | |
end | |
config.before(:each, js: true) do |
def dates_to_time(date_string, created_at) | |
if date_string[/[0-9]+/].blank? | |
# there aren't any numbers in it | |
return 0 | |
else | |
# there's at least one number to derive date from | |
if date_string[/\'(\d){2}/].present? | |
# uses Month '14 for example | |
matched_year = date_string[/\'(\d){2}/] | |
# extrapolate the decade from when this record was created |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
$ rails g model StreamzooPhotos url:string | |
##lib/tasks/streamzoo.rake | |
require 'hpricot' | |
require 'open-uri' | |
namespace :streamzoo do | |
desc "refresh thumbnails" | |
task :update_thumbs => :environment do |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
def smiley(str) | |
str = str.sub(':)', "<img src='/images/emoticons/1.gif' alt='smile'/>") | |
str = str.sub(':(', "<img src='/images/emoticons/2.gif' alt='sad'/>") | |
str = str.sub(';)', "<img src='/images/emoticons/3.gif' alt='wink'/>") | |
str = str.sub(':D', "<img src='/images/emoticons/4.gif' alt='grin'/>") | |
str = str.sub(':P', "<img src='/images/emoticons/5.gif' alt='tongue'/>") | |
end |
## Think Geek Code (controller) [ruby] | |
def thinkGeek | |
require 'rss' | |
rss = RSS::Parser.parse(open('http://www.thinkgeek.com/xml/app/wishlist/id/').read, false) | |
@output = "" + rss.channel.description + "" | |
@output += "" |