Skip to content

Instantly share code, notes, and snippets.

// view
public class Application extends Controller {
public static void index() {
System.out.println("Incoming request...");
List<ToDo> todos = ToDo.find("byDone", false).fetch();
render(todos);
}
# Tic Tac Toe
# A simple game. Users take the role of 'X' or 'O'.
class Board:
def __init__(self):
# | 0 | 1 | 2 |
# -------------
# | 3 | 4 | 5 |
# -------------
# | 6 | 7 | 8 |
var kitchen = {
pots: 4,
pans: 3,
spoons: 5,
fridge: 1,
// ... and so on
};
var kitchen = {
spoons: 2
}
kitchen.__proto__.wallpaper = function() { alert("blue"); }
var kitchen2 = {
spoons: 5,
__proto__: kitchen
}
// Here's how you get Joose
Class("Oven", {
has: {
on_button: {
is: "rw",
init: false
}
},
methods: {
var Menu = Backbone.Model.extend({
dimOld: function() {
var id = this.previous('current');
$('#'+id).removeClass('selected');
},
lightNew: function(current) {
$('#'+current).addClass('selected');
}
});
form = $(query_string);
try {
form_val_array = form.serializeArray();
for(i in form_val_array) {
form_val_array[i] = encodeURIComponent(form_val_array[i]);
} // ... etc
import urllib
# ... etc
urllib.unquote(request.GET.get('field', '').encode('ascii')).decode('utf-8')
var simpler = {};
return simpler;
// dummy app
var connect = require('connect');
function routes(app) {
app.get('/', function(req, res, params) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('I\'m insecure!');
});
}
var server = connect.createServer(
connect.router(routes)