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
/** | |
* Detect delimiter. | |
* @param integer $depth The number of lines from csv file to work with. | |
* @param array $chars Optional. An array of characters to guess. | |
* @param array $lines Sample lines from csv file. | |
* @return string Returns the best guess. | |
*/ | |
private function detect_delimiter( $depth=20, $chars=null, $lines ){ | |
if( !$chars ) |
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
/** | |
* Sort a multidimensional array by datetime. | |
* usage: | |
* usort($array, 'sortByOrder'); | |
*/ | |
function sortByDate($a, $b) { | |
$t1 = strtotime($a['date']); | |
$t2 = strtotime($b['date']); | |
return $t1 - $t2; | |
} |
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 | |
/** | |
* Print a datatype structure parsed for browser | |
* @param mixed $ar The datatype | |
*/ | |
if( !function_exists('ar_print') ){ | |
function ar_print( &$var ){ | |
//get variable name | |
foreach ($GLOBALS as $k => $v) |
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 | |
// Headings and rows | |
$headings = array('ID', 'Name', 'Colour'); | |
$array = array( | |
array(1, 'Apple', 'Green'), | |
array(2, 'Banana', 'Yellow'), | |
array(3, 'Orange', 'Orange'), | |
); |
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 | |
# @author Brian Racer | |
# @link http://jetpackweb.com/blog/2009/07/20/bash-script-to-create-mysql-database-and-user/ | |
EXPECTED_ARGS=3 | |
E_BADARGS=65 | |
MYSQL=`which mysql` | |
Q1="CREATE DATABASE IF NOT EXISTS $1;" |
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 | |
# Update atom from downloaded deb file | |
# @link http://stackoverflow.com/a/26759982/288644 | |
# @author Rudolf http://stackoverflow.com/users/4215411/rudolf | |
rm -rf /tmp/atom.deb | |
curl -L https://atom.io/download/deb > /tmp/atom.deb | |
dpkg --install /tmp/atom.deb | |
echo "***** apm upgrade - to ensure we update all apm packages *****" |
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
#!/usr/bin/env xdg-open | |
[Desktop Entry] | |
Version=1.0 | |
Terminal=false | |
Type=Application | |
Name=Firefox devOps | |
Exec=/opt/firefox-dev/firefox | |
Icon=/opt/firefox-dev/browser/icons/mozicon128.png | |
NoDisplay=true |
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 | |
# | |
# Service script for running a bundled Meteor application under Forever. | |
# Meteor settings JSON file should be in /etc/meteor/[YOUR APP NAME].json, | |
# and the METEOR_SETTINGS var below should be updated as appropriate. | |
# | |
# chkconfig: 345 80 20 | |
# description: My node app | |
# |
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 | |
# myapp daemon | |
# chkconfig: 345 20 80 | |
# description: myapp daemon | |
# processname: myapp | |
# author: daithi-coombes | |
# original http://werxltd.com/wp/2012/01/05/simple-init-d-script-template/ | |
DAEMON_PATH="/path/to/myapp" |
OlderNewer