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
public function processJob($job) | |
{ | |
try { | |
// stuff | |
} catch(Exception $e) { | |
if(Offers\Model::getDb()->errno() == 2006) { | |
Offers\Model::connectDb(); | |
$this->processJob($job); | |
} else { | |
throw $e; |
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 | |
sed -i.bak 's/^\(dbms\.security\.auth_enabled=\).*/\1false/' ./conf/neo4j-server.properties |
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
$q = 'MATCH (n) OPTIONAL MATCH (n)-[r]-() RETURN r,n'; | |
$result = $neoclient->sendCypherQuery($q)->getResult(); | |
$graph = []; | |
foreach ($result->getNodes() as $node) { | |
$graph['nodes'][] = [ | |
'id' => $node->getId(), | |
'label' => $node->getLabels()[0], | |
'group' => $node->getLabels()[0], | |
'properties' => $node->getProperties() |
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 | |
/** | |
* This script is used to process the output of a PHPUnit test run | |
* that uses --log-junit for the purposes of timing each executed | |
* test method. It outputs test methods with their respective | |
* runtimes in order from largest to smallest. Times are in | |
* seconds. The script accepts paths to any number of files in the | |
* JUnit log format. | |
* | |
* Ex: php phpunit-log-junit.php /path/to/junit-log1.xml /path/to/junit-log2.xml ... |
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
<!-- Rich Object stuff --> | |
<meta property="og:url" value="{{ site.url }}{{ page.url }}"> | |
<meta property="og:type" content="website" /> | |
{% if page.title %}<meta property="og:title" value="{% if page.title %}{{ page.title }}{% endif %}"> | |
<meta property="og:description" value="{% if page.description %}{{ page.description }}{% else %}{{site.description}}{% endif %}"> | |
{% else %}<meta property="og:title" value="{{ site.title }}"> | |
<meta property="og:description" value="{{ description }}"> | |
{% endif %}{% if page.cover %}<meta property="og:image" value="{{ site.url }}{{ page.cover }}">{% endif %} |
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 phpargs() { | |
curl -s http://us3.php.net/$1 | \ | |
sed -n '/<div class="methodsynopsis dc-description">/,/<\/div>/p' | \ | |
sed 's/<[^>]*>//g' | tr -d "\n" | |
echo | |
} |
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 | |
// Before (this was repeated 3 times in one script, copy and pasted exactly...) | |
for($i=0,$btotal=0,$total=0,$page=1;$lclass=$row['class'],$lwhse=$row['whse'],$row=mysql_fetch_array($res);$i++,$total+=$row['cost'],$btotal+=$row['cost'],$gtotal+=$row['cost']) { | |
// ...snip.. 35 lines of echo statements dumping HTML | |
} | |
// Removing all the unused variables reduced it down to: | |
for ($i = 0; $row = mysql_fetch_array($res); $i++) { | |
// Same 35 lines of echo statements dumping HTML |
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
# Mouse support | |
setw -g mode-mouse on | |
set-option -g mouse-select-pane on | |
set-option -g mouse-select-window on | |
set -g mouse-resize-pane on | |
set -g mouse-select-window on | |
# tmux vi mode | |
setw -g mode-keys vi |
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
exec { "change_httpd_user": | |
command => "sed -i 's/www-data/vagrant/g' /etc/apache2/envvars", | |
onlyif => "/bin/grep -q 'www-data' '/etc/apache2/envvars'", | |
notify => Service['apache2'], | |
require => Package['apache2'], | |
} | |
file { "/var/lock/apache2": | |
ensure => "directory", | |
owner => "vagrant", |
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
# pretty-print a JSON result | |
curl 'https://graph.facebook.com/memphispython/albums/' | jq '.' | |
# grab the data list | |
curl 'https://graph.facebook.com/memphispython/albums/' | jq '.data' | |
# Get *just* the first album | |
curl 'https://graph.facebook.com/memphispython/albums/' | jq '.data[0]' | |
# Narrow that first entry to some specific data |
OlderNewer