Skip to content

Instantly share code, notes, and snippets.

View tcr's full-sized avatar
🚮
bad command or file name

Tim Ryan tcr

🚮
bad command or file name
View GitHub Profile
import urllib
import urllib.parse
import urllib.request
import sys
ip = input('Enter IP address: ')
path = input('Enter path to save data to (with trailing \): ')
while 1:
print('')
var RocketGame;
var __extends = function(child, parent) {
var ctor = function(){ };
ctor.prototype = parent.prototype;
child.__superClass__ = parent.prototype;
child.prototype = new ctor();
child.prototype.constructor = child;
};
RocketGame = function() {
var text;
# namespaces
NS: ->
ns: (->)
ns::dontEnum: (key) ->
ns::[key]: @[key]
delete @[key]
return new ns()
blocks: new NS()
\0068\u0074\u0074\u0070\u003A\u002F\u002F\u0077\u0077\u0077\u002E\u0079\u006F\u0075\u0074\u0075\u0062\u0065\u002E\u0063\u006F\u006D\u002F\u0077\u0061\u0074\u0063\u0068\u0&#x3
@tcr
tcr / imousepad.py
Created March 15, 2011 08:26
imousepad.py - Server for iMousePad HTML5 demo.
#!/usr/bin/env python
# References:
# http://stackoverflow.com/questions/4372657/websocket-handshake-problem-using-python-server/5282208#5282208
# http://popdevelop.com/2010/03/a-minimal-python-websocket-server/
# http://ubuntuforums.org/showthread.php?t=715256
#
# mouse
#
@tcr
tcr / imousepad.html
Created March 16, 2011 03:27
imousepad.html - HTML5 WebSocket demo for iMousePad.
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Mousepad (Disconnected)</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<style>
body, html { padding: 0; margin: 0; background: black; overflow: hidden }
@tcr
tcr / selection.coffee
Created June 13, 2011 01:28
Cross-Browser Selection Utilities
########################################################################
# Cross-Browser Selection Utilities
# Provides a 'selection' object with an API supporting
# all modern browsers (using window.getSelection())
# and IE5+ (using TextRanges)
########################################################################
root = this
if root.getSelection
@tcr
tcr / async.coffee
Created July 18, 2011 21:13
Serial/Parallel functions in CoffeeScript
# Asynchronous DSL for CoffeeScript
serial = (f) ->
next = -> arr.shift().apply(null, arguments) if arr.length
arr = (v for k, v of f(next))
next()
null
parallel = (f, after = ->) ->
res = {}; arrc = 0
@tcr
tcr / async.coffee
Created July 19, 2011 05:40 — forked from walling/async.coffee
Lean and Mean Serial function in CoffeeScript
# Lean and Mean Serial/Parallel DSL for CoffeeScript
# - based of https://gist.github.com/1090670 by timcameronryan,
# https://gist.github.com/1091019 by walling
serial = (spec) ->
steps = (func for key, func of spec when key != 'catch')
next = (err, args...) ->
return spec.catch(err) if err
steps.shift().apply(next, args) if steps.length > 0
next null
@tcr
tcr / code.coffee
Created October 22, 2011 02:05
How do you insert text into the middle of a text node, and also move the cursor with it?
insertData = (n, offset, str) ->
if offset > 0
prefix = n.nodeValue.substr(offset-1, 1)
n.insertData offset-1, prefix + str
n.deleteData offset-1 + str.length + 1, 1
else
n.parentNode.insertBefore n.ownerDocument.createTextNode(str), n