[Web][1a] - [iTunes][1b]
[Web][2a] - [iTunes][2b]
=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') |
get '/blog*' do | |
path = params[:splat][0] | |
source_url = 'http://yourblog.tumblr.com' + path.gsub(/ /, '+') | |
source_content_type = '' | |
source_body = open(source_url) do |f| | |
source_content_type = f.content_type # "text/html" | |
f.read | |
end | |
if source_content_type == 'text/html' | |
output_base = request.base_url + '/blog' |
def minutes_in_words(timestamp) | |
timestamp = Time.at(timestamp) | |
minutes = (((Time.now - timestamp).abs)/60).round | |
return nil if minutes < 0 | |
case minutes | |
when 0..1 then "less than 1 minute" | |
when 1..2 then "1 minute ago" | |
when 2..59 then "#{minutes} minutes ago" |
$(document) | |
.on("ajaxError", function(e, request, textStatus, errorThrown) { | |
window.open("/__better_errors", "error"); | |
}); |
// Update the appropriate href query string parameter | |
function paramReplace(name, string, value) { | |
// Find the param with regex | |
// Grab the first character in the returned string (should be ? or &) | |
// Replace our href string with our new value, passing on the name and delimeter | |
var re = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
delimeter = re.exec(string)[0].charAt(0), | |
newString = string.replace(re, delimeter + name + "=" + value); | |
return newString; |
require 'sinatra' # gem install sinatra --no-rdoc --no-ri | |
set :port, 3000 | |
set :environment, :production | |
html = <<-EOT | |
<html><head><style> | |
#text{width:100%; font-size: 15px; padding: 5px; display: block;} | |
</style></head><body> | |
<input id="text" placeholder="Write then press Enter."/> | |
<div id="chat"></div> |
# first: | |
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
# go to /usr/local/lib and delete any node and node_modules | |
cd /usr/local/lib | |
sudo rm -rf node* |