Skip to content

Instantly share code, notes, and snippets.

Plan for actually getting shit done
===================================
1. Do not read emails or answer forum questions until 5pm every day. That way they don't piss me off for the rest of the day.
2. Set aside Friday afternoons for shitty process stuff that I can't completely avoid or delegate. That way it doesn't intrude on important work or make me depressed and not want to do anything for the rest of the week.
3. Spend rest of time actually getting shit done and creating cool stuff.
4. Profit!

Automated solver for 2048

This is a script which runs a "bot" that tries to solve the incredibly addictive 2048 game. It makes use of Groovy and browser automation with Geb.

How to

  • First step, if you don’t have it, you need to install Groovy.

  • Second step is to install the Google Chrome WebDriver (just unzip the appropriate file to a local directory)

  • Next, edit the script to set the path to the Chrome Driver

  • then execute the script: groovy solver2048.groovy

import org.vertx.groovy.core.Vertx
class BootStrap {
def init = { servletContext ->
def vertx = Vertx.newVertx()
def httpServer = vertx.createHttpServer()
vertx.createSockJSServer(httpServer).installApp(prefix: '/events') { sock ->
sock.dataHandler { buff ->
sock << buff
@dongwq
dongwq / phonegap-jquerymobile.js
Created March 31, 2012 05:56 — forked from dongyuwei/phonegap-jquerymobile.js
解决jquerymobile用phonegap打包后后退导航失效问题
document.addEventListener("deviceready", function(){
var initUrl = location.href;
if (Device.platform === 'Android') {
//阻止按后退按钮就退出程序
navigator.app.overrideBackbutton(true);
}
/*解决jquerymobile用phonegap打包后后退导航失效问题*/
document.addEventListener("backbutton", function(){