Skip to content

Instantly share code, notes, and snippets.

View improved-broccoli's full-sized avatar

improved-broccoli

View GitHub Profile
<?php
/**
* Create a web friendly URL slug from a string.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
* @copyright Copyright 2012 Sean Murphy. All rights reserved.

Keybase proof

I hereby claim:

  • I am jbenoit2011 on github.
  • I am jbenoit (https://keybase.io/jbenoit) on keybase.
  • I have a public key whose fingerprint is CB2C 319D D85D E2DF FFB6 4AD5 7A12 A623 009B 7B83

To claim this, I am signing this object:

@improved-broccoli
improved-broccoli / underscore-to-camelcase.sh
Last active August 29, 2015 14:25
[Perl One-liner] Variable from underscore to camelCase
perl -i.bak -pe 's/(\$|\->)([a-z]+)_(([a-z])([a-z]+)_)*([a-z])([a-z]+)+(;|\s)/$1$2\U$4\L$5\U$6\L$7$8/g'
@improved-broccoli
improved-broccoli / printmemusage.js
Created November 2, 2015 15:35
Print memory usage in nodejs scripts
var lodash = require('lodash');
function printMemUsage() {
console.log(lodash.values(lodash.mapValues(process.memoryUsage(), function (v) {
return (v/(Math.pow(1024, 2))).toFixed(0);
})).join());
}
@improved-broccoli
improved-broccoli / master-to-develop.sh
Created November 23, 2015 10:37
In case you start to commit on master and you wish to switch to develop
#!/bin/bash
echo "This script will switch your master with your develop. Only in your local repository."
echo "Develop will be created from master, then master will be destroyed, finally a new empty master will be created"
echo
read -p "Press [Enter] key to start ..."
git checkout master &&\
git checkout -b develop && \ # Create develop
@improved-broccoli
improved-broccoli / gist:0e84a48344d6bfe2b98d
Created March 21, 2016 17:24
dicatoros-error-msg-stack-dump
in DiactorosFactory.php line 36
at DiactorosFactory->__construct() in appDevDebugProjectContainer.php line 5789
at appDevDebugProjectContainer->getSensioFrameworkExtra_Psr7_Converter_ServerRequestService() in bootstrap.php.cache line 2187
at Container->get('sensio_framework_extra.psr7.converter.server_request') in appDevDebugProjectContainer.php line 5773
at appDevDebugProjectContainer->getSensioFrameworkExtra_Converter_ManagerService() in bootstrap.php.cache line 2187
at Container->get('sensio_framework_extra.converter.manager') in appDevDebugProjectContainer.php line 5755
at appDevDebugProjectContainer->getSensioFrameworkExtra_Converter_ListenerService() in bootstrap.php.cache line 2187
at Container->get('sensio_framework_extra.converter.listener') in ContainerAwareEventDispatcher.php line 183
at ContainerAwareEventDispatcher->lazyLoad('kernel.controller') in ContainerAwareEventDispatcher.php line 128
at ContainerAwareEventDispatcher->getListeners('kernel.controller') in TraceableEventDispatcher.php line 23