git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
require 'thread' | |
semaphore = Mutex.new | |
a = Thread.new { | |
semaphore.synchronize { | |
# access shared resource | |
} | |
} | |
b = Thread.new { |
#!/bin/bash | |
# Nasty, intentionally verbose script to start/stop mongod | |
# Mark Woods - March 2010 | |
RUNTIME_USER='nobody' # only applicable on Linux, otherwise runs as current user | |
LOGPATH='/var/log/mongodb/mongod.log' | |
CONFIGFILE='/etc/mongod.conf' | |
DBPATH='/opt/mongodb/data/db' | |
BINPATH='/opt/mongodb/bin/mongod' |
# WAIT! Do consider that `wait` may not be needed. This article describes | |
# that reasoning. Please read it and make informed decisions. | |
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/ | |
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations? | |
describe 'Modal' do | |
should 'display login errors' do | |
visit root_path |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
// JavaScript function for converting simple XPath to CSS selector. | |
// Ported by Dither from [cssify](https://github.com/santiycr/cssify) | |
// Example: `cssify('//div[@id="girl"][2]/span[@class="body"]//a[contains(@class, "sexy")]//img[1]')` | |
var sub_regexes = { | |
"tag": "([a-zA-Z][a-zA-Z0-9]{0,10}|\\*)", | |
"attribute": "[.a-zA-Z_:][-\\w:.]*(\\(\\))?)", | |
"value": "\\s*[\\w/:][-/\\w\\s,:;.]*" | |
}; |
Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true
and false
. In Python, for example, they're written as True
and False
. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).
This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.
If you want to use or share this material, please see the license file, below.
var urls = [ | |
/* Wildcard CORS enabled - Works in PhantomJS 1.9.0 */ | |
'http://updates.html5rocks.com', | |
/* CORS disabled - Fails in PhantomJS 1.9.0 (and every other version) */ | |
'http://www.google.com', | |
/* Hack workaround? */ | |
/* | |
function(httpGet, callback) { | |
phantom.page.settings = (phantom.page.settings || {}); | |
phantom.page.settings.webSecurityEnabled = false; |
There are many (old) clients available:
The Google Analytics API is at v3 (at time of writing).
This example uses Google's Ruby API client to access Analytics. Use https://github.com/google/google-api-ruby-client (Google supported).
document.getElementsByTagName('button')[0].onclick = function () { | |
scrollTo(document.body, 0, 1250); | |
} | |
function scrollTo(element, to, duration) { | |
var start = element.scrollTop, | |
change = to - start, | |
currentTime = 0, | |
increment = 20; | |
People
:bowtie: |
😄 :smile: |
😆 :laughing: |
---|---|---|
😊 :blush: |
😃 :smiley: |
:relaxed: |
😏 :smirk: |
😍 :heart_eyes: |
😘 :kissing_heart: |
😚 :kissing_closed_eyes: |
😳 :flushed: |
😌 :relieved: |
😆 :satisfied: |
😁 :grin: |
😉 :wink: |
😜 :stuck_out_tongue_winking_eye: |
😝 :stuck_out_tongue_closed_eyes: |
😀 :grinning: |
😗 :kissing: |
😙 :kissing_smiling_eyes: |
😛 :stuck_out_tongue: |