This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A helper class for cronjobs. | |
* | |
* @author C. Davison | |
*/ | |
class CronHelper | |
{ | |
/** | |
* Valid & unique date format strings for each type of cron part. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use JMS\Serializer\Annotation as JMS; | |
use JMS\Serializer\SerializerBuilder; | |
class A { | |
/** | |
* @JMS\Type("integer") | |
*/ | |
protected $x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Lists all unique branches merged into given branch, assuming regular commit message given | |
# | |
# Params: | |
# - Name of branch to assess | |
# | |
function whatson() { | |
git log --oneline $1 | grep "Merge branch.*$1" | cut -d' ' -f4 | sort | uniq | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
XDEBUG='zend_extension.*=.*xdebug' | |
function xdebug_on { | |
if grep -q "^;$XDEBUG" $1; then | |
echo "Enabling Xdebug $1" | |
cat $1 | sudo sed -i.bak "s|^;\($XDEBUG\)|\1|g" $1 | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/symfony/ $ # Ensure COMPOSER_HOME='~/.composer/' | |
~/symfony/ $ composer global require psy/psysh | |
~/symfony/ $ # Obtain sysh script | |
~/symfony/ $ chmod +x sysh | |
~/symfony/ $ mkdir -p ~/.composer/bin/ | |
~/symfony/ $ mv sysh ~/.composer/bin/ | |
~/symfony/ $ # Add ~/.composer/bin to path if necessary | |
~/symfony/ $ sysh | |
Psy Shell v0.7.2 (PHP 5.6.20-1+deb.sury.org~precise+1 — cli) by Justin Hileman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
WEBROOT=~/www/ | |
if [ ! -d $WEBROOT ]; then | |
mkdir $WEBROOT -p | |
fi | |
cd $WEBROOT | |
# Attempt to update the repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var cdn, config; | |
if (typeof MathJax !== "undefined" && MathJax !== null) { | |
return; | |
} | |
config = document.createElement('script'); | |
config.setAttribute('type', 'text/x-mathjax-config'); | |
config.innerHTML = "MathJax.Hub.Config({\n tex2jax: {inlineMath: [['$','$'], ['\\\\(','\\\\)']]}\n});"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
call_user_func(function () { | |
$autoloader = 'vendor/autoload.php'; | |
do { | |
if (is_readable($autoloader)) { | |
require_once $autoloader; | |
echo "Autoloader loaded: $autoloader.\n"; | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TodoList = React.createClass({ | |
render: function () { | |
return <ul> | |
{this.props.items.map(function (v) { return <li>{v}</li>; })} | |
</ul>; | |
} | |
}); | |
var Todo = React.createClass({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class JSONResponse implements JSend, Sendable | |
{ | |
private $data; | |
public function error($message, $code = 0, $data = null) | |
{ | |
$this->data = array( | |
'status' => self::STATUS_ERROR, |
NewerOlder