Skip to content

Instantly share code, notes, and snippets.

View kyriakidischronis's full-sized avatar

Chronis Kyriakidis kyriakidischronis

View GitHub Profile
@kyriakidischronis
kyriakidischronis / Howto.md
Last active August 29, 2015 14:16 — forked from n1k0/Howto.md

Put test1.js and test2.js into a tests/ directory, then run the suite:

$ casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js
Test file: /Users/nperriault/tmp/pre-inc/pre.js                                 
Hey, I'm executed before the suite.
Test file: /Users/nperriault/tmp/pre-inc/tests/test1.js                         
# this is test 1
Hi, I've been included.
PASS Subject is strictly true
// code adapted from http://uk.php.net/manual/en/function.file-put-contents.php#82934
// a subfolder called 'cache' within the directory that this code is in
define("FILE_PUT_CONTENTS_ATOMIC_TEMP", dirname(__FILE__).DIRECTORY_SEPARATOR."cache");
// give owner, group and public write access after writing the file
define("FILE_PUT_CONTENTS_ATOMIC_MODE", 0777);
function file_put_contents_atomic($filename, $content) {
// generate a temporary file
// Greek Social Security Number Validation (AMKA)
// Αλγόριθμος ορθότητας ΑΜΚΑ
function validateAMKA(amka) {
if (!amka.match(/^\d{11}$/) || amka == '00000000000')
return false;
var iSum = 0;
for (var i = 1; i <= amka.length; i++) {
var iDigit = parseInt(amka.charAt(i - 1), 10);
if (i % 2 === 0) {