Skip to content

Instantly share code, notes, and snippets.

View doughsay's full-sized avatar
⌨️
clickety clack

Chris Dosé doughsay

⌨️
clickety clack
View GitHub Profile
@doughsay
doughsay / toasty.coffee
Last active December 11, 2015 18:08
Toasty!
soundData = 'SUQzAwAAAAAAEFRDT04AAAAGAAAAT3RoZXL/+pDAv8oAABVeLuYZKgACvhglw7WgAfBYg33wCvAG/wgQAuPAxwAJgfwFB4Eo4DQH/AzIcL5hb8AUU/8A6oBIWAMIEKAmH//ACTgHSwJAACgYtgFAn/+AMcAKgBfcLnA1WOM3///ELhq8d4rcd5cE7ltD///0iPFxkoGIBBgarHG4euK5////+JwFxjljJnyAFQMSDsNwvuM4MgFkYbf/////////mwncWeKXGUFkHiaFwF8LTBjyTEAx8DIClBjx3mIoHKAhHc0yBJlLQdGhx9RUFCQ5eGDDBhREMEAkSNpCRlnyQIYDJARpFRhA5hxBlhoZbKh4xgkQkig6CiY0NOjlMKsGZZtEo7GEUkCuBpSvAyB5ZhmkRs2ps1IY7GT5kxhii4lTMoEW+ZMiYkaYkmPLyVeJa0ArXn+M2jKxIBKiJEChLchQEUCTDjyI4FhhIPLbITSIeJAQEvTUeSkjRdRChsDAV3F4Em3kYnflE4HqEJsJxYlVAIPERQZkNiARDBEZADDwsEphZdItKcIHNgoyAWbkqazjJzO+4HUB3xn/+pLATywXg9VkwS4N50mCwRflwd3pMcECSzPjMpk51kgQ4A2MyAM6EgAudpBxMjCgEgRkcTVAYZMSVFCZztxikBlwZlz5gjANNAIUCgw6FNghLLGDAGjTGDOjYkLAlYUrS1hEAdRMl9QMaRdBAVMFc4NIGXFOeyV+X5QoGg4EDu23yFS5Ejy+8Ntaa24qdMrnYd4YlhODgmT/MYgEMy2mO8oOEmFMTQzMOBqMbDEAy6aEzGmFBjqCOkRlA4JQoynl5DHzIyZfMERAIIAQhBQKIhUIPQ4xBwErQIRYxsYM3gDMQA5ZsN+cDACkyo8250MHiIINBzHiwIPBhc9KUADy5RkQachcdE4VBEgweDgkGXVbUv4FAKVjY3cdt7U+2RIvM6tkoGQqQac0idU1V2uRvVWy9uc801FRJhV
@doughsay
doughsay / gist:4709486
Last active December 12, 2015 03:48
in-memory js db interface idea
db = require './db'
objects = new db.Collection
objects.addIndex {id: db.UNIQUE}
objects.addIndex {type: db.INDEX}
objects.insert {id: 1, name: 'foo' type: 'thing'}
objects.insert {id: 2, name: 'bar' type: 'thing'}
objects.insert {id: 3, name: 'baz' type: 'animal'}
@doughsay
doughsay / gist:4710971
Last active December 12, 2015 03:58
Moo code for getting latest tweet
http = require 'http'
options =
host: 'api.twitter.com'
path: "/1/statuses/user_timeline/#{$iobjstr}.json?count=1&include_rts=1"
http.get options, (response) ->
output = []
response.on 'data', (chunk) ->
output.push chunk
@doughsay
doughsay / colors.sh
Created May 16, 2013 21:44
Bash color variables
# Regular
blk='\[\e[0;30m\]' # Black - Regular
red='\[\e[0;31m\]' # Red
grn='\[\e[0;32m\]' # Green
ylw='\[\e[0;33m\]' # Yellow
blu='\[\e[0;34m\]' # Blue
pur='\[\e[0;35m\]' # Purple
cyn='\[\e[0;36m\]' # Cyan
wht='\[\e[0;37m\]' # White
@doughsay
doughsay / gist:5620771
Created May 21, 2013 15:36
Sublime preferences
{
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Bright.tmTheme",
"default_line_ending": "unix",
"detect_indentation": true,
"font_face": "Source Code Pro",
"font_size": 15.0,
"ignored_packages":
[
"Vintage"
],
@doughsay
doughsay / ff-parallel-failures.coffee
Last active December 18, 2015 17:29
Do many async operations and keep track of which ones fail and which ones succeed, using ff.
succeedAsync = (ms, cb) ->
setTimeout ->
console.log 'succeeding: ' + ms
cb null, 'success: ' + ms
, ms
failAsync = (ms, cb) ->
setTimeout ->
console.log 'failing: ' + ms
cb 'fail: ' + ms
@doughsay
doughsay / socket-bridge.js
Created July 3, 2013 19:00
Accept socket.io connections and bridge to a tcp socket.
var net = require('net'),
io = require('socket.io').listen(8888);
io.sockets.on('connection', function (web_socket) {
var mud_socket = net.connect(4321, function() { // localhost is assumed
// client connected
web_socket.on('input', function(input_data) {
mud_socket.write(input_data);
});
@doughsay
doughsay / subl.json
Last active December 27, 2015 19:49
A good default ST3 settings file without any font/color/theme declarations.
{
"default_line_ending": "unix",
"detect_indentation": true,
"ensure_newline_at_eof_on_save": true,
"rulers":
[
80
],
"scroll_past_end": true,
"tab_size": 2,
@doughsay
doughsay / iterm2_helpers.sh
Last active August 29, 2015 14:07
Helper functions for coloring and naming iTerm tabs
# Usage:
# Source this script from your Bash start-up script (eg. ~/.bashrc, ~/.bash_profile) (or ~/.zshrc if using zsh, etc.).
#
# Setting titles:
# title something
# title "more than 1 word"
#
# Setting tab colors:
# tab_color 195 89 76
# tab_color 219 154 88
@doughsay
doughsay / pry-remote.rb
Created October 2, 2014 21:49
Continuously listen for remote-pry sessions.
require 'socket'
require 'timeout'
def is_port_open?(ip, port)
begin
Timeout::timeout(1) do
begin
s = TCPSocket.new(ip, port)
s.close
return true