This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var kitchen = { | |
pots: 4, | |
pans: 3, | |
spoons: 5, | |
fridge: 1, | |
// ... and so on | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var kitchen = { | |
spoons: 2 | |
} | |
kitchen.__proto__.wallpaper = function() { alert("blue"); } | |
var kitchen2 = { | |
spoons: 5, | |
__proto__: kitchen | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here's how you get Joose | |
Class("Oven", { | |
has: { | |
on_button: { | |
is: "rw", | |
init: false | |
} | |
}, | |
methods: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Menu = Backbone.Model.extend({ | |
dimOld: function() { | |
var id = this.previous('current'); | |
$('#'+id).removeClass('selected'); | |
}, | |
lightNew: function(current) { | |
$('#'+current).addClass('selected'); | |
} | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
# ... etc | |
urllib.unquote(request.GET.get('field', '').encode('ascii')).decode('utf-8') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var simpler = {}; | |
return simpler; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |