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
<?php | |
// Copyright (C) 2007 Robert Wallis - July 11, 2007 | |
function json_database($recordset) | |
{ | |
if (0==count($recordset)) | |
return '[]'; | |
$o = "[\n"; | |
foreach($recordset as $records) | |
{ | |
$o .= '{'; |
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
<?php | |
phpinfo(INFO_ALL); |
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
<?php | |
error_reporting(E_ALL); | |
function error_handler($number, $string, $file, $line) | |
{ | |
if (intval(E_WARNING) != intval($number)) | |
{ | |
print("PHP Error: ".$number." ".$file."(".$line.")"."<br />".$string."<br />"); | |
} | |
} |
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
<?php | |
// debug() - Copyright (C) 2006-2009 Robert Wallis | |
// print out the value to be read in the browser | |
if (!function_exists('debug')) | |
{ | |
function debug($value, $name='') | |
{ | |
print('<pre>'); | |
if ($name) |
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
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer tempus, felis eget suscipit posuere, tellus nibh interdum pede, vitae malesuada nibh tellus ac augue. Proin ullamcorper, nunc vel viverra egestas, risus lorem tincidunt metus, nec porttitor massa eros sed libero. Nunc felis. Aliquam vel massa. Donec ante justo, aliquam sollicitudin, condimentum consequat, volutpat at, nunc. In eu magna. Vestibulum libero. Donec sem arcu, tempus quis, tempus in, sollicitudin at, diam. Quisque odio felis, nonummy quis, euismod ac, gravida ut, lectus. Maecenas bibendum metus eu risus. | |
Proin porta mi vulputate est. Etiam tortor quam, molestie sit amet, pharetra non, varius eu, mi. Duis tincidunt risus vel orci. Sed pede elit, sollicitudin eu, dapibus non, tincidunt sit amet, diam. Donec turpis. Integer volutpat. Suspendisse potenti. Integer eleifend velit ut diam. Nullam varius wisi vitae massa. Vivamus massa tortor, varius eget, vestibulum at, vestibulum eu, leo. Nunc rutrum. Donec eros urna, varius id, viverra n |
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
// usage: valid = validateCard('4111111111111111'); | |
function validateCard(cardno) { | |
if (cardno.length <= 0 || cardno.length < 13 || cardno.length > 20 ) { | |
return false; | |
} | |
var sum = 0 * 0; | |
var digits = cardno.split(''); | |
digits.reverse(); | |
for (var i = 0; i < digits.length; i++) { | |
var d = 1 * digits[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
// debug() - Copyright (C) 2006-2008 Robert Wallis | |
function debug(obj, name) | |
{ | |
var t = ""; | |
if (name) { | |
t += ""+name+":"; | |
} | |
for (var i in obj) { | |
t += i+"=\""+obj[i]+"\"\n"; |
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: Robert Wallis - [email protected] | |
// Returns a channel of all the possible permutations of a string containing | |
// r length in characters. | |
// adopted from http://docs.python.org/library/itertools.html | |
func StringPermutationsSub(s string, r int) chan string { | |
out := make(chan string) | |
go func() { | |
defer close(out) | |
pool := []int(s) // get unicode | |
n := len(pool) |
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
// directly from http://docs.python.org/library/itertools.html | |
def permutations(iterable, r=None): | |
# permutations('ABCD', 2) --> AB AC AD BA BC BD CA CB CD DA DB DC | |
# permutations(range(3)) --> 012 021 102 120 201 210 | |
pool = tuple(iterable) | |
n = len(pool) | |
r = n if r is None else r | |
if r > n: | |
return | |
indices = range(n) |
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
JADE_C="../node/node_modules/jade/bin/jade" | |
template_OUT=../../static | |
template_JADE=*.jade */*.jade | |
template_HTML=$(foreach source_file, $(template_JADE), ${template_OUT}/${source_file:.jade=.html}) | |
.PHONY: all | |
all: $(template_HTML) | |
$(template_OUT)/%.html: %.jade |
OlderNewer