Skip to content

Instantly share code, notes, and snippets.

View iampeterbanjo's full-sized avatar
💭
Error24: not enough hours in the day

Peter Banjo iampeterbanjo

💭
Error24: not enough hours in the day
View GitHub Profile
@iampeterbanjo
iampeterbanjo / gulpfile.js
Last active August 29, 2015 14:20
Email testing with gulp-litmus and friends
var gulp = require('gulp')
, litmus = require('gulp-litmus')
, gutil = require('gulp-util')
, ftp = require('gulp-ftp')
, inlineCss = require('gulp-inline-css')
, replace = require('gulp-replace')
, runSequence = require('run-sequence')
, config = require('./config.json')
;
@iampeterbanjo
iampeterbanjo / snap-svg-animation.js
Created January 27, 2015 07:02
Animating SVG paths using Snap SVG
function revealPath (path, options) {
var revealedAttributes = {'stroke-dashoffset': 0}
, options = options || {}
, easing = mina[options.ease] || mina.easein
, duration = options.duration || 1000
path.animate(revealedAttributes, duration, easing, options.afterRevealPath)
}
function getHiddenAttributes (path) {
@iampeterbanjo
iampeterbanjo / task tests and results
Created November 13, 2013 11:10
Errors testing Backbone.Collection with TiTouchDB
# Test results
# task model:
# - has working migration for development (FAILED)
# - Expected 0 to equal 6.
# - can set and save a new task (FAILED)
# - Expected 0 to equal 7.
# - can mark a task as complete (ok)
# - can fetch complete tasks (FAILED)
# - Error: Assertion failed: Cannot reindex view 'completed' which has no map block set
# - can remove completed tasks (FAILED)
@iampeterbanjo
iampeterbanjo / gist:7041182
Last active December 25, 2015 21:19
Problem testing Alloy controllers based on alloy-unit-test
it('create with 2 items', function () {
item.set({
title: "The cloud atlas",
author: "David Mitchell"
});
item.save();
item.set({
title: "Design of design",
author: "Brooks"
@iampeterbanjo
iampeterbanjo / decypher_niantic.js
Created November 9, 2012 21:21
decypher niantic crypto text
/*
* copy and paste into your browser's console to run and
* then use like so
* interprete("Jajwd tujwfynts wjfhmjx f wnxp-fxxjxxrjsy xyflj. Fy ymnx utnsy rd ijyjwrnsfynts nx ymfy snfsynh nx hfzxnsl rtwj ywtzgqj ymfs ny nx btwym")
*/
// simple deciphering scheme
var alphabet = "abcdefghijklmnopqrstuvwxyz";
var sillyAlphabet = "vwxyzabcdefghijklmnopqrstu";
var decrypt = {};
@iampeterbanjo
iampeterbanjo / test_String.removeSpecialCharacters.js
Created June 25, 2012 21:00
test String.removeSpecialCharacters
// checks our test conditions
// @param - condition (function) test to run
// @param - ref (string) to display for result
assert = function (condition, ref){
if(condition){
console.log("+ Passed: " + ref);
} else {
console.log("- Failed: " + ref, 'warn');
}
};
@iampeterbanjo
iampeterbanjo / String.removeSpecialCharacters.js
Created June 25, 2012 20:53
String.removeSpecialCharacters
// remove special characters from strings
// @return {string}
String.prototype.removeSpecialCharacters = function (){
return this.replace(/\t|\?|\r/gi,'').replace(/\n|\_|\-/gi,' ');
};
@iampeterbanjo
iampeterbanjo / email-validation-by-regex.js
Created July 27, 2011 21:52
JavaScript email validation test
function log(message){
if(window.console){
console.log(message);
}
}
function warn(message){
if(window.console){
console.warn(message);
}
@iampeterbanjo
iampeterbanjo / with-example.js
Created May 5, 2011 22:07
An example of using "with"
var table = {}, cloth = {};
table.clean = false;
cloth.clean = true;
// clean the table please
function wipeTable(cloth){
console.log("cleaning table");
if(cloth.clean){
table.clean = true;
@iampeterbanjo
iampeterbanjo / strip-new-line-character.sql
Created March 2, 2011 20:28
find and remove the new-line character using sql
SELECT TRIM(TRAILING SUBSTR(value,NEW_LINE_INDEX-1)
FROM value) as NEW_VALUE
FROM (
SELECT INSTR(value, "\n")
AS NEW_LINE_INDEX,
value
FROM table
WHERE value != ""
ORDER BY value
) findNewLines