Skip to content

Instantly share code, notes, and snippets.

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=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')
@ichiban
ichiban / how-to-post-multipart-form-data-with-oauth.rb
Created July 11, 2011 04:50
How to post multipart/form-data with OAuth in Ruby
require 'oauth/consumer'
require 'net/http/post/multipart'
OAuth::VERSION = 1.0
consumer = OAuth::Consumer.new('consumer_key', 'consumer_secret',
:site => 'http://provider.example.com',
:request_token_path => '/request_token',
:authorize_path => '/authorize',
:access_token_path => '/access.token')
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@obstschale
obstschale / octave.md
Last active June 8, 2024 19:46
An Octave introduction cheat sheet.
@Papillard
Papillard / etsy_scraper.rb
Created July 21, 2015 16:22
Wish-list live-code batch #11
require "nokogiri"
require "open-uri"
def etsy_results(product)
url = "https://www.etsy.com/search?q=#{product}"
file = open(url)
doc = Nokogiri::HTML(file)
results = []
doc.search(".card-meta").each do |item|
@AshuMaths1729
AshuMaths1729 / Idea for AI Project.docx
Last active September 21, 2021 04:16
AI Project Ideas to start with
Idea for AI Project "Our future will be written in code."
1) Take a book in electronic format like a Jane Austen book from project Gutenberg. Take the last chapter in that book. Remove all the spaces.
Now write a computer program to put all the spaces back. You can easily count how many it got right since you have the original text.
1. Do it using Hidden Markov Models based on a frequency dictionary of English.
2. Do it using a Genetic Algorithm using an oracle based on the same frequency dictionary.