This file contains 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
/*jslint indent: 2 */ | |
var factorial = function (x) { | |
"use strict"; | |
var results = 1; | |
if (x === 0) { return results; } | |
results = x * factorial(x - 1); | |
return results; | |
}; |
This file contains 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
/* | |
Thank you, almighty! | |
http://www.nczonline.net/blog/2011/10/11/simple-maintainable-templating-with-javascript/ | |
*/ | |
function sprintf(text){ | |
var i=1, args=arguments; | |
return text.replace(/%s/g, function(pattern){ | |
return (i < args.length) ? args[i++] : ""; | |
}); | |
} |
This file contains 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
// ----------------------------------------------------------------- | |
// Image management helpers | |
// | |
// Returns `background` declarations in three modes: single, | |
// sprites, embed. | |
// | |
// * `single` will return the original image. This is default in | |
// dev mode. | |
// * `sprited` will return the images position on a already | |
// generated sprite map. |
This file contains 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
# coding=utf-8 | |
from pymongo import Connection | |
# configuration | |
MONGODB_HOST = "localhost" | |
MONGODB_PORT = 27017 | |
MONGODB_DB = "guidenext" | |
def get_collection(name): | |
connection = Connection(MONGODB_HOST, MONGODB_PORT) |
This file contains 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
/*jslint devel:true, browser:true, indent:2, maxlen: 70 */ | |
(function (window) { | |
"use strict"; | |
var Condition, Listener, watcher; | |
// Requires window.matchMedia: | |
// https://developer.mozilla.org/en/DOM/window.matchMedia | |
if (typeof window.matchMedia === "undefined") { return; } | |
Condition = function (mq, callback) { |
This file contains 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
/* | |
By Anders Ytterström 2012. | |
Example use: | |
<script src="autocomplete.js"></script> | |
<script> | |
var values = ["Hansi", "Andre", "The Omen", "Marcus", "Prince Charles"], | |
callback = function (k) { | |
console.log(k); | |
}; |
This file contains 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
''' | |
Example htmldump_config.py: | |
url = "http://localhost:5000" | |
login = "admin@adeprimo.se" | |
password = "app161770" | |
def pages_to_validate(): | |
pages = [ | |
# event registration |
This file contains 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
from os import listdir | |
from os.path import isdir | |
from simples3 import S3Bucket # pip install simples3 | |
root = "../static" | |
exclude = [".DS_Store"] | |
A = "access key" | |
B = "secret key" | |
bucket = "guidenext" |
This file contains 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
{ | |
"Version":"2008-10-17", | |
"Statement":[{ | |
"Sid":"AllowPublicRead", | |
"Effect":"Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action":["s3:GetObject"], | |
"Resource":["arn:aws:s3:::bucket/*" |
This file contains 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
#!/bin/sh | |
# | |
# requires node.js: | |
# brew install node | |
# npm install jslint | |
# | |
ROOT_DIR=$(git rev-parse --show-toplevel) | |
JSLINT="${ROOT_DIR}/node_modules/.bin/jslint" |