This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//notice that there are no parameters defined, but arguments are still copied | |
function doSomething () { | |
var args = Array.prototype.slice.call (arguments); | |
console.log (args); | |
} | |
doSomething ("Water", "Salt", "Glue"); // ["Water", "Salt", "Glue"] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The best way to think about the difference between throwing errors and catching errors is this: you should catch errors only if you know exactly what to do next. The purpose of catching an error is to prevent the browser from responding in its default manner; the purpose of throwing an error is to provide information about why an error occurred. - Zakas, Nicholas C. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//source: http://stackoverflow.com/questions/500431/javascript-variable-scope | |
// a globally-scoped variable | |
var a=1; | |
// global scope | |
function one(){ | |
alert(a); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo kextunload /System/Library/Extensions/AppleHDA.kext | |
sudo kextload /System/Library/Extensions/AppleHDA.kext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string const state[21][15] = | |
{ | |
/* ignore me */ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", | |
/* start */ "", "2", "4", "6", "19", "8", "19", "19", "12", "19", "14", "17", "1", "19", "", | |
/* in id */ "", "2", "2", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "", | |
/* end id */ "", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "", | |
/* in # */ "", "5", "4", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "", | |
/* end # */ "", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "", | |
/* in {} */ "", "6", "6", "6", "7", "6", "6", "6", "6", "6", "6", "6", "6", "6", "", | |
/* end {} */ "", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://127.0.0.1:4444/wd/hub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BASE_URL = 'http://google.com'; | |
var assert = require('assert'), | |
webdriver = require('selenium-webdriver'), | |
colors = require('colors'); | |
//build all the drivers to be used | |
var chrome_driver = new webdriver.Builder(). | |
withCapabilities(webdriver.Capabilities.chrome()). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '../..')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To disable the Macbook keyboard, type (or copy and paste) the following into terminal: | |
sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ | |
To re-enable it, type (or copy and paste) the following into terminal (if copying and pasting, don't forget to copy a linebreak to make the command work): | |
sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X GET -H 'Authentication: this:that' 'http://localhost:3001/myserver/cmd' | python -mjson.tool |
OlderNewer