Skip to content

Instantly share code, notes, and snippets.

@deathcap
deathcap / gist:7393584
Created November 10, 2013 03:55
kb-controls mouse test right-click
var raf = require('raf')
, kb = require('./index')
var pre = document.createElement('pre')
document.body.appendChild(pre)
var ctl = kb({
'<left>': 'strafe_left'
, '<right>': 'strafe_right'
@deathcap
deathcap / gist:8065908
Created December 21, 2013 05:45
image-rendering CSS broken on Chrome (ok on Firefox and Safari) test case
<img
style="image-rendering: -webkit-optimize-contrast; image-rendering: -moz-crisp-edges;"
width="80"
height="80"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0HPBLsF+vuUlhfwX4j/rSfAJ4H1H0qZJ9dN7nR19frRTeBt4Fe9FwpwtN+2p1MXscGLHR9SXrmMgjONd1ZxKzpBeA71b4tNhj6JGoyFNp4GHgwUp9qplfmnFW5oTdy7NamcwCI49kv6fN5IAHgD+0rbyoBc3SOjczohbyS1drbq6pQdqumllRC/0ymTtej8gpbbuVwpQfyw66dqEZyxZKxtHpJn+tZnpnEdrYBbueF9qQn93S7HQGGHnYP7w6L+YGHNtd1FJitqPAR+hERCNOFi1i1alKO6RQnjKUxL1GNjwlMsiEhcPLYTEiT9ISbN15OY/jx4SMshe9LaJRpTvHr3C/ybFYP1PZAfwfYrPsMBtnE6SwN9ib7AhLwTrBDgUKcm06FSrTfSj187xPdVQWOk5Q8vxAfSiIUc7Z7xr6z
@deathcap
deathcap / gist:8467663
Created January 17, 2014 02:56
pngcrush on ProgrammerArt v2.0
https://github.com/deathcap/ProgrammerArt/issues/8
ProgrammerArt $ pngcrush -rem alla -rem text -d /tmp/textures/items/ textures/items/*
| pngcrush 1.7.70
| Copyright (C) 1998-2002, 2006-2013 Glenn Randers-Pehrson
| Portions copyright (C) 2005 Greg Roelofs
| This is a free, open-source program. Permission is irrevocably
| granted to everyone to use this version of pngcrush without
| payment of any fee.
| Executable name is pngcrush
@deathcap
deathcap / gist:85ac493cac913b1257c7
Created May 13, 2014 04:05
doppiojvm craftbukkit 1.7.2-R0.3 java.lang.NullPointerException: at org.apache.logging.log4j.util.ProviderUtil.<clinit>(ProviderUtil.java:54)
DoppioJVM https://github.com/plasma-umass/doppio 77826e3088aa41241eb2444541bd4da5fb982669
http://localhost:8000/
/tmp$ java -jar craftbukkit-1.7.2-R0.3.jar
Loading libraries, please wait...
java.lang.ExceptionInInitializerError
at org.bukkit.craftbukkit.Main.main(Main.java:159)
Caused by: java.lang.ExceptionInInitializerError
at net.minecraft.server.v1_7_R1.MinecraftServer.<clinit>(MinecraftServer.java:46)
@deathcap
deathcap / gist:89be2b006ba1b381e837
Created May 16, 2014 02:20
doppio GH-313 TypeError: Cannot call method 'map' of undefined at Method.java_lang_Class.getInterfaces()[Ljava/lang/Class
logs for https://github.com/plasma-umass/doppio/issues/313
natives_refactor 71190b58be6dd63f17f2d8dc9c5305ce9bf7f9e4
doppio $ ./doppio-dev classes/test/CustomClassLoader2
Loading Dog...
Loading class classes.test.Dog
Finding class classes.test.Dog
Defining class classes.test.Dog
Registering class classes.test.Dog
@deathcap
deathcap / gist:b6d787435b560b281b03
Last active August 29, 2015 14:01
Gradle vs Maven, >2x faster build times
(note: mostly fixed by removing 'clean' from gradle defaultTasks)
Junket $ time ./gradlew
:clean UP-TO-DATE
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava UP-TO-DATE
@deathcap
deathcap / gist:4624e58ca86311797a10
Last active August 29, 2015 14:15
node-minecraft-protocol#packets-1.8 login failure
node-minecraft-protocol $ MC_USERNAME=test NODE_DEBUG=mc-proto node examples/client_echo.js
You are using a pure-javascript implementation of RSA.
Your performance might be subpar. Please consider installing URSA
MC-PROTO: 3064 Old-styling packet
MC-PROTO: 3064 writing packetId handshaking.set_protocol (0x0)
MC-PROTO: 3064 { protocolVersion: 47,
serverHost: 'localhost',
serverPort: 25565,
nextState: 2 }
MC-PROTO: 3064 Old-styling packet
@deathcap
deathcap / gist:898bec7260a0b0dbf5cd
Last active August 29, 2015 14:15
browserifying node-minecraft-protocol yggdrasil auth -> superagent -> mime, fs.readFileSync mime type reading error
try.js:
var mime = require('mime');
browserify try.js > b.js
<script src="b.js"></script>
Uncaught TypeError: undefined is not a function
b.js:2621 module.exports.load
b.js:2662 (anonymous function)
@deathcap
deathcap / gist:3eb80f28b4545345f084
Last active August 29, 2015 14:15
Notes on converting CoffeeScript to ES6

Some quick notes on hand-converting from CoffeeScript to ES6/ECMAScript 2015 (e.g. for use with bablejs):

  • add 'use strict'; to beginning of file
  • add let before new variable assignments, or const if they are constant
  • add semicolons to end of statements (optional)
  • add commas between elements of multi-line array literals
  • add parenthesizes around function calls
  • add braces around blocks
  • replace (args) => with (args) => { arrow functions
  • replace for x in a with for (let x of a) {