Skip to content

Instantly share code, notes, and snippets.

handle: function(request, response) {
var self = this,
context = new requestcontext.RequestContext({request:request}),
isNewPlayerCommand,
implResponse;
isNewPlayerCommand = self.impl.isNewPlayerCommand(context);
if (!isNewPlayerCommand) {
/*
* WARNING
* This is just an idea. This code might not actually run. There are no
* tests. It was abandoned before I could finish it.
*/
/*
* AutoQueue
*
* www.github.com/jtwb
@jtwb
jtwb / gist:849639
Created March 1, 2011 18:51
document.write
/*
* DJSParserSemantics.mixins.withParserDocwrite
*
* Parse HTML chunk, peek at the DOM and amend
* the live DOM with new nodes. Parsing must pause
* as soon as </script.*?> appears, so we force this
* by breaking the markup into chunks.
*/
var write = function(parser, out) {
@jtwb
jtwb / HTML4-entities.json
Created March 8, 2011 23:36
HTML4 Named Entities
/*
* All HTML4 named entities mapped to unicode values
*
* http://www.w3.org/TR/html4/sgml/entities.html
*
* Please reuse this code however you like.
*
* Note that &apos; from XHTML 1.0 is not included.
*/
@jtwb
jtwb / gist:969335
Created May 12, 2011 20:07
Javascript getter/setter unified API
var getOwnPropertyDescriptor = function(obj, property) {
if (!obj) return;
if (obj.__lookupGetter__) {
return {
get: obj.__lookupGetter__(property),
set: obj.__lookupSetter__(property)
};
} else {
return Object.getOwnPropertyDescriptor(obj, property);
@jtwb
jtwb / minstrings.txt
Created May 17, 2011 22:37
debugging strings from dominateJS
"[ DJS ] "
"[ DJS ] "
"[ DJS ] "
"WARNING: Attempt to execute deferred event handler "
" failed!"
"Replacing script node for introspection support"
"Executing an inline script..."
" while attempting to execute this inline script: "
"Finished precache-ing resource at "
"Failed to precache resource at "
@jtwb
jtwb / gist:1132823
Created August 8, 2011 21:35
RSubmit HTML Response
<tr id="record-4b809a8f7b2d357a3e17a0abd4160b7f-show" class="DNSEditor-textRow DNSEditor-verifyingRow ">
<td class="DNSEditor-column-recordType">
<div class="DNSEditor-recordType recordType-A"><strong>A</strong></div>
</td>
<td class="DNSEditor-column-recordName">
<span class="truncated" title="testabc.etsyworlddomination.com">testabc</span>
</td>
<td class="DNSEditor-column-verb">points to</td>
<td class="DNSEditor-column-recordValue">
<span class="truncated" title="184.106.169.29">184.106.169.29</span>
@jtwb
jtwb / gallery
Created January 19, 2012 20:28 — forked from anonymous/gallery
@jtwb
jtwb / ps1.sh
Created June 28, 2012 21:49
Sexy PS1 with collapsed git branch name and dirs stack
function dirs_depth () {
echo `dirs -v | wc -l`
}
function parse_git_branch () {
BRANCH=$(git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
BLEN=$(echo `echo $BRANCH | wc -c` " - 1" | bc)
echo $BRANCH | cut -c1 | sed -e "s/^./${BLEN}\0/"
}
@jtwb
jtwb / vmup.sh
Created July 24, 2012 20:25
VMWare headless
# With Vmware Fusion bin path in $PATH...
alias vmup="vmrun -T fusion start $HOME/Documents/Virtual\ Machines.localized/$VMIMAGE.vmwarevm/$VMIMAGE.vmx nogui"
alias vmp="vmrun -T fusion pause $HOME/Documents/Virtual\ Machines.localized/$VMIMAGE.vmwarevm/$VMIMAGE.vmx"
alias vusu="ssh -A -l $VMUSER $VMIP"