Skip to content

Instantly share code, notes, and snippets.

<?php
function arrayToSql($array=array(),$pre='',$post='',$xor='&&')
{
$end = end(array_keys($array));
$sql = $pre;
foreach($array as $k =>$v){
$sql .= "`$k` = '$v' ";
if($k != $end){
$sql .= "$xor ";
@mithereal
mithereal / timeout_detect.php
Last active August 29, 2015 14:23
detect php max timeout limit on shared hosting
<?php
$max_timeout = 600;
$start = time();
register_shutdown_function('shutdown',$start);
for(;;)
{
$finish = time();
@mithereal
mithereal / gist:542e24104ebd6cb040d9
Last active August 29, 2015 14:20
aws ubuntu vagarant box with erlang and php5
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrant on AWS
# Jason Clark
# This sample sets up 1 VM ('delta') with erlang, and apache installed.
# Adjustable settings
CFG_TZ = "US/Pacific" # timezone, like US/Pacific, US/Eastern, UTC, Europe/Warsaw, etc.
@mithereal
mithereal / pre-commit
Created June 5, 2014 01:12
chicago boss pre-commit hook
#!/bin/sh
#
#This is a pre commit hook for Chicage Boss
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell | sed "s/\"*//g" > .preferred_otp_version
@mithereal
mithereal / install-opencart-plugin.sh
Last active August 29, 2015 14:01
command line opencart module installer
#!/bin/bash
DESTINATION_HELP='-p project_destination_path'
PROJECT_HELP='-r Resets the Project dir'
CWD=$(pwd)
function help()
{
echo ""
echo "Opencart Plugin Installer by Jason Clark <[email protected]>"
@mithereal
mithereal / chicago-boss-version-pre-commit
Last active August 29, 2015 13:59
chicago boss version commit hook
#!/bin/bash
### get version
VER=$(cat src/*.app.src | grep -Po 'appver."[0-9]*\.[0-9]*\.[0-9]"' | grep -Po '[0-9]*\.[0-9]*\.[0-9]')
VER_ARRAY=(`echo $VER | tr "." "\n"`)
echo "Type of Release: Maj(j), Min(m), Patch(p) (blank skips release tag)"
read type
if ["$type" == "j"]
then