Skip to content

Instantly share code, notes, and snippets.

@colmjude
colmjude / pts
Created November 25, 2010 17:47
Pull tiddlyspace tiddlers down
#!/bin/sh
# cheap and cheerful pushing of files to TiddlySpace,
# authorization taken from the variable TIDDLYSPACE_AUTH which for me is:
# export TIDDLYSPACE_AUTH='-u myuser:mypass'
# usage: sts spacename file1 file2 ..
space="$1" ; shift
tiddler="$1" ;
# public/private
@colmjude
colmjude / simpledate.js
Created June 6, 2011 16:33
Turns Javascript Date Objects into human readable form
var simpleDate = (function() {
var measures = {
second: 1,
minute: 60,
hour: 3600,
day: 86400,
week: 604800,
month: 2592000,
year: 31536000
@colmjude
colmjude / localextend.js
Created July 26, 2011 10:02
Extends the Local Storage Object to accept and retrieve objects
Storage.prototype.setObject = function(key, value) {
this.setItem(key, JSON.stringify(value));
};
Storage.prototype.getObject = function(key) {
return this.getItem(key) && JSON.parse(this.getItem(key));
};
@colmjude
colmjude / butterfly_colmjude.js
Created September 8, 2011 20:40
Javascript Jungle Butterfly
jj.createCreature('butterfly_colmjude', function (creature) {
// Give your creature a size.
creature.size({width: 50, height: 50});
var element = creature.el;
jj.jQuery("<img src='http://colmjude.com/images/butterfly.svg'/>")
.css({'width': '100%', 'height': '100%'})
.prependTo(element);
/*
Usage:
@include keyframes(animate) {
0% { left: 0%; }
100% { left: 100%; }
}
*/
@mixin keyframes($name) {
@-webkit-keyframes $name { @content; }
@-moz-keyframes $name { @content; }
@colmjude
colmjude / _mixins.scss
Created October 28, 2013 14:52
Couple of sass mixins I use regularly * vendor prefix * placeholder text
/* Usage:
@include vendor-prefix(border-radius, 2px);
*/
@mixin vendor-prefix($name, $argument) {
@each $prefix in -webkit-, -moz-, -ms-, -o-, '' {
#{$prefix}#{$name}: $argument;
}
}
/* Usage:
(function($) {
console.log( $("#trigger-overlay") );
var hls = $(".yourHighlight");
var book = $(".bookMain");
var quotes = [];
hls.each(function(el, ind, arr) {
var hl = {
"highlight": el.find(".highlight").text(),
"title": book.find(".title a").text(),
@colmjude
colmjude / lr-dev-env-pop.sh
Created September 1, 2014 15:59
I kept having to remember where I'd recorded what steps I needed to take to load in some useful test data so hopefully this will make things easier. Usage instructions below.
#!/bin/bash
OLDPWD=$(pwd)
cd apps/service-frontend/ && ./create-user-for-integration-tests.sh && cd "$OLDPWD"
cd apps/casework-frontend/ && ./create-user-for-integration-tests.sh && cd "$OLDPWD"
if [ -z "$1" ] ; then
echo "No argument supplied; loading 1 title"
cd apps/generate-test-data/ && ./load_test_data_into_dev_environment.sh 1 && cd "$OLDPWD"
else
@colmjude
colmjude / rio_calc.rb
Created February 12, 2015 14:12
RIO Calc script
module PensionsCalculator
class RioCalc
def initialize(potsize)
@potsize = potsize
end
def run_calc()
person = PensionsCalculator::Person.new;
person.salary = 50000;
module PensionsCalculator
class RioCalc
def initialize(potsize)
@potsize = potsize
end
def run_calc()
person = PensionsCalculator::Person.new;
person.salary = 50000;