Skip to content

Instantly share code, notes, and snippets.

@daithi-coombes
daithi-coombes / nipple.js
Created July 8, 2015 15:36
dhtmlx-gannt meteor
/**
* first add meteor packages:
* meteor add dhtmlx:gantt
* meteor add dhtmlx:gantt-data
* @author daithi coombes <webeire@gmail.com>
*/
TasksCollection = new Mongo.Collection("tasks");
LinksCollection = new Mongo.Collection("links");
@daithi-coombes
daithi-coombes / atom_update.sh
Created May 28, 2015 15:10
Update Atom deb script
#!/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 *****"
@daithi-coombes
daithi-coombes / createdb
Created May 10, 2015 11:42
Bash script to create db and user from command line
#!/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;"
<?php
// Headings and rows
$headings = array('ID', 'Name', 'Colour');
$array = array(
array(1, 'Apple', 'Green'),
array(2, 'Banana', 'Yellow'),
array(3, 'Orange', 'Orange'),
);
@daithi-coombes
daithi-coombes / ar_print.php
Last active August 29, 2015 14:01
print a html formated version of print_r including variable name
<?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)
/**
* 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;
}
@daithi-coombes
daithi-coombes / wordpress.menu.php
Created April 22, 2014 20:42
dynamically create wordpress menu
/**
* Credit from here: @http://wordpress.stackexchange.com/questions/50168/how-do-i-create-predefined-menus-for-my-theme/50332#50332
*/
function register_my_menus() {
$menus = array(
'Main menu' => array(
'slug' => 'main-menu',
'menu_items' => array(
'Home' => site_url(),
@daithi-coombes
daithi-coombes / get_months.php
Created March 26, 2014 09:41
Get an array of months between two dates
$StartDate = @strtotime("Jan 2003");
$StopDate = @strtotime("Apr 2004");
/**
* Gets list of months between two dates
* @param int $start Unix timestamp
* @param int $end Unix timestamp
* @return array
*/
function echoDate( $start, $end ){
/**
* 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 )
REPORTER = dot
test:
@npm install
@NODE_ENV= ./node_modules/.bin/mocha \
--reporter $(REPORTER) \
--recursive \
--ui bdd \
tests