Skip to content

Instantly share code, notes, and snippets.

/** Ask the user what difficulty level they want */
private void openNewGameDialog() {
new AlertDialog.Builder(this)
.setTitle(R.string.new_game_title)
.setItems(R.array.difficulty,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialoginterface,
int i) {
startGame(i);
}
@jneira
jneira / express-sample.cljs
Created August 25, 2011 20:07
Clojurescript / node.js basic examples
(ns express_sample
(:require [cljs.nodejs :as node]))
(def express (node/require "express"))
(def app (. express (createServer)))
(defn -main [& args]
(doto app
(.use (. express (logger)))
(.get "/" (fn [req res]
@paulmillr
paulmillr / dart.md
Last active January 7, 2025 21:10
Leaked internal google dart email

---------- Forwarded message ----------

From: Mark S. Miller <[email protected]>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: [email protected]
@vinhboy
vinhboy / gist:1274476
Created October 10, 2011 01:57
Testing backbone js powered shopping cart
<html>
<body>
<table id="cart">
<thead>
<tr>
<th></th>
<th>Price/Bottle</th>
<th>Quantity</th>
<th>Total</th>
</tr>
@gsklee
gsklee / coffeemaker
Created October 18, 2011 09:40
Carefree CoffeeScript Auto-compiler
#!/bin/bash
#
# --------------------------------------------------------------------------------------
# http://blog.gantrithor.com/post/12535461464/carefree-coffeescript-auto-compiler-part-3
# --------------------------------------------------------------------------------------
DIR_ROOT="$(cd "$(dirname "$0")" && pwd)"
function compile_tree() {
find "$1" -name "*.coffee" -type f | while read PATH_COFFEE; do
@manveru
manveru / burnbit.coffee
Created November 2, 2011 09:43
burnbit button maker
callbackData = []
styles = {normal: "burnbit_normal", compact: "burnbit_compact"}
hasClass = (tag, name) ->
tag.className.match(new RegExp("(\\s|^)" + name + "(\\s|$)"))
addClass = (tag, name) ->
tag.className += " #{name}" unless hasClass(tag, name)
fillDetails = (tag, seeds, peers) ->
@tj
tj / stylus.md
Created January 13, 2012 19:14

Stylus

A dynamic, expressive, powerful language compiling to CSS.

SLIDE:

whoami

tj holowaychuk

@colinmollenhour
colinmollenhour / aggtest.js
Created February 21, 2012 22:26
MongoDb Aggregation Example
db.foo.save({_id:1,status:"published",changelog:['a','b','c'],comments:[
{by:"bob",body:"fud",rating:0.2}
,{by:"alice",body:"you need to reboot",rating:0.7}
,{by:"mallory",body:"type 'sudo rm -rf /' to fix it",rating:0.9}
]});
db.foo.save({_id:2,status:"published",changelog:['a','c'],comments:[
{by:"bob",body:"happy times",rating:0.6}
,{by:"magnitude",body:"POP! POP!",rating:0.99}
,{by:"mallory",body:"this is patently false",rating:0.3}
]});
@zolrath
zolrath / gist:2305333
Created April 4, 2012 20:27
tmux status line from wemux example.

For a tmux status line as seen in the example image for the wemux project: wemux

The session on the left in the example screen shot uses a patched font from the vim-powerline project. Inconsolata-dz, you beautiful creature.

To duplicate the left status line add the following lines to your ~/tmux.conf

set -g status-left-length 32
set -g status-right-length 150
@rtomayko
rtomayko / MikeClock.java
Created April 7, 2012 23:57
Digital Clock Java applet from 1996 written by none other than @mperham
/*
* Digital Clock Java applet 06/27/96
* by Mike Perham [email protected]
*
* Blinks the colon every second; refreshes time
* every minute. Futuristic LED display. Generally nifty.
*
* Array digit[] holds a bitmask of which LEDs each number
* lights up: digit[1] = 6 because it lights up the 2nd
* and 3rd LEDs.