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
(function(context) { | |
'use strict'; | |
var Timer = Java.type('java.util.Timer'); | |
var Phaser = Java.type('java.util.concurrent.Phaser'); | |
var TimeUnit = Java.type('java.util.concurrent.TimeUnit'); | |
var AsyncHttpClient = Java.type('com.ning.http.client.AsyncHttpClient'); | |
var timer = new Timer('jsEventLoop', false); | |
var phaser = new Phaser(); |
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
// A simple object with some methods, | |
// which throw errors when bad arguments are passed. | |
var maths = { | |
square : function (value) { | |
// Validity checking | |
if (arguments.length !== 1) { | |
throw new Error('square: Requires one and only one argument'); | |
} | |
if (typeof value !== 'number') { | |
throw new Error('square: Requires numeric argument'); |
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
/* This code is derived from: | |
* http://www.arduino.cc/en/Tutorial/Melody | |
* This plays the chest noise from the Legend of Zelda on a piezo buzzer connected to pin 9 and ground. It has been tuned to a buzzer I had on hand, but you may want to adjust the values, testing against a tuner. | |
*/ | |
int speakerPin = 0; | |
const int switchPin = 1; | |
char notes[] = "gabygabyxzCDxzCDabywabywzCDEzCDEbywFCDEqywFGDEqi azbC"; // a space represents a rest | |
int length = sizeof(notes); // the number of notes |
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
#!/bin/bash | |
# figure out the absolute path to the script being run a bit | |
# non-obvious, the ${0%/*} pulls the path out of $0, cd's into the | |
# specified directory, then uses $PWD to figure out where that | |
# directory lives - and all this in a subshell, so we don't affect | |
# $PWD | |
GAMEROOT=$(cd "${0%/*}" && echo $PWD) |
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
# spec/controllers/api_clients_controller_spec.rb | |
RSpec.describe APIClientsController, type: :controller do | |
let(:api_client) { mock_model(APIClient) } | |
context "when HTTP Digest auth credentials are invalid" do | |
before do | |
authenticate_with_http_digest("invalid_login", "invalid_password") do | |
get :index | |
end | |
end |
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
{ | |
init: function(elevators, floors) { | |
var floorButtons = new Array(floors.length); | |
var floorTime = new Array(floors.length); | |
var UP = 1; | |
var DOWN = 2; | |
var DISABLED = 4; | |
for (var i = 0; i < floorButtons.length; i++) { | |
floorButtons[i] = 0; | |
floorTime[i] = 0; |
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 h = require('hyperscript'); | |
var CronJob = require('cron').CronJob; | |
var nodemailer = require('nodemailer'); | |
var craigslist = require('node-craigslist'); | |
var options = { | |
category : 'cta', | |
maxAsk : '9000', | |
minAsk : '1000' | |
}; |
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
"""Perlin noise implementation.""" | |
# Licensed under ISC | |
from itertools import product | |
import math | |
import random | |
def smoothstep(t): | |
"""Smooth curve with a zero derivative at 0 and 1, making it useful for | |
interpolating. |
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
<!DOCTYPE NETSCAPE-Bookmark-file-1> | |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | |
<!-- This is an automatically generated file. | |
It will be read and overwritten. | |
Do Not Edit! --> | |
<TITLE>Bookmarks</TITLE> | |
<H1>Bookmarks</H1> | |
<DL><p> | |
<DT><A HREF="https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html#//apple_ref/doc/-%20uid/TP40014508" ADD_DATE="1414706885" PRIVATE="0" TAGS="javascript,mac,osx,yosemite">JavaScript for Automation Release Notes</A> | |
<DD>This article describes JavaScript for Automation, a new feature in OS X Yosemite. |
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
function foo(x,y = function(){ return x; }) { | |
console.log( "a:", x ); | |
var x = 1; | |
console.log( "b:", y() ); | |
} | |
foo(2); |