View ajax-ich.js
$(document).ready( function() { | |
$.ajax({ | |
type: "GET", | |
dataType: 'text', | |
async: false, | |
url: "templates.html" | |
}).done(function(response) { | |
$("body").append(response); | |
ich.grabTemplates(); | |
}); |
View ich-loop.js
$(document).ready( function() { | |
$('#display').click(function () { | |
var data = [ | |
{ | |
"name": "Paul McCartney", | |
"email": "paul.mccartney@beatles.com", | |
"salary": "400" | |
}, | |
{ | |
"name": "John Lennon", |
View concat-ich.sh
#!/bin/bash | |
path="src/main/web" | |
> "$path"/templates.ich | |
for file in "$path"/templates/* | |
do | |
cat "$file" >> "$path"/templates.ich |
View ich-template-loader.js
var TemplateLoader = { | |
path: 'templates/', // template files are stored in this directory | |
templates: ['file1', 'file2', 'file3'], // put all your template files here | |
fetchTemplate: function(path) { | |
$.ajax({ | |
type: 'GET', | |
dataType: 'text', | |
async: false, | |
url: path | |
}).done(function(response) { |
View sum_dict_switch.py
# define entries | |
entries = [{'type': '+', 'value': 9},\ | |
{'type': '+', 'value': 12.3},\ | |
{'type': '-', 'value': 4},\ | |
{'type': '+', 'value': 0.89},\ | |
{'type': '-', 'value': 2.65},\ | |
{'type': '-', 'value': 14.3},\ | |
{'type': '+', 'value': 6.8},\ | |
{'type': 'unknown', 'value': 200}] |
View time_clock.py
import time | |
start = time.clock() | |
for x in range(1,10000): | |
y = x**3 | |
elapsed = time.clock() - start | |
print elapsed |
View bind.js
// binding "this" object only (function arguments are ignored) | |
if (!Function.prototype.bind) { | |
Function.prototype.bind = function bind(thisObject) { | |
var fun = this; | |
return function() { | |
fun.apply(thisObject, arguments); | |
}; | |
}; | |
} |
View bind.js
// binding both "this" object and optionally arguments | |
if (!Function.prototype.bind) { | |
Function.prototype.bind = function bind(thisObject) { | |
var fun = this, boundArgs = Array.prototype.slice.call(arguments, 1); | |
return function() { | |
var allArgs = boundArgs; | |
if (arguments.length) { | |
allArgs = allArgs.concat(Array.prototype.slice.call(arguments)); | |
} |
View knotify.py
#!/usr/bin/python | |
import sys, dbus | |
knotify = dbus.SessionBus().get_object("org.kde.knotify", "/Notify") | |
try: title, text = sys.argv[1:3] | |
except: print 'Usage: knotify.py title text'; sys.exit(1) | |
knotify.event("warning", "kde", [], title, text, [], [], 0, 0, dbus_interface="org.kde.KNotify") |
View curry.js
if (!Function.prototype.curry) { | |
(function () { | |
var slice = Array.prototype.slice; | |
Function.prototype.curry = function () { | |
var target = this; | |
var args = slice.call(arguments); | |
return function () { | |
var allArgs = args; |
OlderNewer