Skip to content

Instantly share code, notes, and snippets.

var simpler = {};
return simpler;
import urllib
# ... etc
urllib.unquote(request.GET.get('field', '').encode('ascii')).decode('utf-8')
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
var Menu = Backbone.Model.extend({
dimOld: function() {
var id = this.previous('current');
$('#'+id).removeClass('selected');
},
lightNew: function(current) {
$('#'+current).addClass('selected');
}
});
// Here's how you get Joose
Class("Oven", {
has: {
on_button: {
is: "rw",
init: false
}
},
methods: {
var kitchen = {
spoons: 2
}
kitchen.__proto__.wallpaper = function() { alert("blue"); }
var kitchen2 = {
spoons: 5,
__proto__: kitchen
}
var kitchen = {
pots: 4,
pans: 3,
spoons: 5,
fridge: 1,
// ... and so on
};
# 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 |
// 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);
}
public class SumTwo
{
public static void main(String[] args)
{
int a = 4;
int b = 5;
int result = a + b;
System.out.println(result);