Skip to content

Instantly share code, notes, and snippets.

View pierswarmers's full-sized avatar
🏡
Working remotely since 2018

Piers Warmers pierswarmers

🏡
Working remotely since 2018
View GitHub Profile
@pierswarmers
pierswarmers / flattenExceptionBacktrace.php
Created December 18, 2017 23:38 — forked from Thinkscape/flattenExceptionBacktrace.php
Make any PHP Exception serializable by flattening complex values in backtrace.
<?php
function flattenExceptionBacktrace(\Exception $exception) {
$traceProperty = (new \ReflectionClass('Exception'))->getProperty('trace');
$traceProperty->setAccessible(true);
$flatten = function(&$value, $key) {
if ($value instanceof \Closure) {
$closureReflection = new \ReflectionFunction($value);
$value = sprintf(
'(Closure at %s:%s)',
#!/bin/bash
DYNAMODB_USER=vagrant
sudo apt-get install openjdk-7-jre-headless -y
cd /home/${DYNAMODB_USER}/
mkdir -p dynamodb
cd dynamodb
@pierswarmers
pierswarmers / mobile-meta-links.html
Created October 11, 2012 23:36
iOS Web App Configuration
@pierswarmers
pierswarmers / less_watcher.sh
Created September 4, 2012 04:25
Script to run watchr and compile LESS
#!/bin/bash
# These are the original commands, courtesy of:
# http://www.ravelrumba.com/blog/watch-compile-less-command-line/
# Requires watchr: https://github.com/mynyml/watchr
# watchr -e 'watch(".*\.less$") { |f| system("lessc #{f[0]} > #{f[0]}.css && echo \"#{f[0]} > #{f[0]}.css\" "}') }
# Requires inotify-tools: https://github.com/rvoicilas/inotify-tools
# while true;do N=`find -name "*.less" `;inotifywait -qe modify $N ;for f in $N;do lessc $f ${f%.*}.css;done;done
@pierswarmers
pierswarmers / less_watcher.sh
Created September 4, 2012 04:24
Script to run watchr and compile LESS
#!/bin/bash
# These are the original commands, courtesy of:
# http://www.ravelrumba.com/blog/watch-compile-less-command-line/
# Requires watchr: https://github.com/mynyml/watchr
# watchr -e 'watch(".*\.less$") { |f| system("lessc #{f[0]} > #{f[0]}.css && echo \"#{f[0]} > #{f[0]}.css\" "}') }
# Requires inotify-tools: https://github.com/rvoicilas/inotify-tools
# while true;do N=`find -name "*.less" `;inotifywait -qe modify $N ;for f in $N;do lessc $f ${f%.*}.css;done;done
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {