Skip to content

Instantly share code, notes, and snippets.

Wade Simmons wadey

Block or report user

Report or block wadey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wadey
wadey / iterm2.zsh
Last active Nov 8, 2019
Change iTerm2 tab color when using SSH
View iterm2.zsh
# Usage:
# source iterm2.zsh
# iTerm2 tab color commands
# https://iterm2.com/documentation-escape-codes.html
if [[ -n "$ITERM_SESSION_ID" ]]; then
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
View campfire.json
Emoji: {
'sunny': '2600',
'zap': '26a1',
'leaves': '1f343',
'lipstick': '1f483',
'cop': '1f46c',
'wheelchair': '267f',
'fish': '1f413',
'hammer': '1f52c',
'moneybag': '1f4b0',
View gist:979052
$ npm install thrift --loglevel info
npm info it worked if it ends with ok
npm info using npm@1.0.6
npm info using node@v0.4.7
npm info addNamed [ 'thrift', '' ]
npm info into /Users/wade/sandbox/ttest thrift@0.6.0-1
npm info installOne thrift@0.6.0-1
npm info unbuild /Users/wade/sandbox/ttest/node_modules/thrift
npm info preinstall thrift@0.6.0-1
npm info build /Users/wade/sandbox/ttest/node_modules/thrift
View campfire.json
Emoji: {
'sunny': '2600',
'zap': '26a1',
'leaves': '1f343',
'lipstick': '1f483',
'cop': '1f46c',
'wheelchair': '267f',
'fish': '1f413',
'hammer': '1f52c',
'moneybag': '1f4b0',
View gist:859619
# works
# func({a: 1, b: 2})
func
a: 1
b: 2
# doesn't work
# func(1, 2)
func
1
View index.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
@import url("http://github.com/simplegeo/polymaps/raw/v2.4.0/examples/example.css");
html, body {height: 100%;}
svg {display: block;}
.layer circle {fill: #f00;stroke: #000;stroke-width: 2px;}
</style>
View scheduler_client.js
var thrift = require('thrift');
var sys = require('sys');
var scheduler_thrift = require('./gen-nodejs/JobExchange.js'),
scheduler_ttypes = require('./gen-nodejs/scheduler_types.js');
var conn = thrift.createConnection('localhost', 8081),
client = thrift.createClient(scheduler_thrift, conn);
conn.on('error', function(err) {
View timeout-fails.js
// This example attempts to time out before the connection is established
var net = require('net');
var start = Date.now();
var stream = net.createConnection(9999, 'google.com');
stream.setTimeout(1000);
@wadey
wadey / example-server.js
Created Dec 31, 2010
Example node-thrift server
View example-server.js
var thrift = require('thrift');
var JobExchange = require('./gen-nodejs/JobExchange'),
ttypes = require('./gen-nodejs/scheduler_types');
var server = thrift.createServer(JobExchange, {
insert_job: function(job, callback) {
// job is an instance of ttypes.Job
process.nextTick(function() {
callback(1);
@wadey
wadey / get_location_1.js
Created Dec 21, 2010
SimpleGeo JavaScript getLocation examples
View get_location_1.js
client.getLocation({enableHighAccuracy: true}, function(err, position) {
if (err) {
// Could not retrieve location information. Check err for more information
} else {
// Latitude and longitude available in position.coords
}
});
You can’t perform that action at this time.