Skip to content

Instantly share code, notes, and snippets.

View dprevite's full-sized avatar
🐈

Dan Previte dprevite

🐈
View GitHub Profile
@dprevite
dprevite / parse_brackets.php
Created May 8, 2014 20:52
parse_brackets.php
<?php
function parse() {
$special = [
'[' => ']',
'{' => '}',
'(' => ')'
];
$string = str_split('(())');
@dprevite
dprevite / laravel_app.conf
Created May 5, 2014 18:01
Laravel listener supervisor
[program:laravel_app]
command=/usr/bin/php /var/www/production/api.thing.com/artisan queue:listen -vvv --queue=App --env=production
directory=/var/www/production/api.thing.com
stdout_logfile=/var/www/production/api.thing.com/app/storage/logs/app_supervisord.log
redirect_stderr=true
@dprevite
dprevite / .vimrc
Last active December 27, 2015 08:29 — forked from JeffreyWay/.vimrc
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@dprevite
dprevite / checkout_all_branch_to_dirs.php
Last active December 15, 2015 16:08
Pulls all feature branches to their own folders so they can be served by the web server for easy QA. These are run via cron. *.branches.projectdomain.com
#!/usr/bin/php
<?php
// Constants we need to do things
define('WEB_ROOT', '/var/www/branches.projectdomain.com/'); // Requires trailing slash!
define('GIT', '/usr/bin/git');
define('GIT_REPO', WEB_ROOT . '__base__/'); // Requires trailing slash!
define('GIT_DIR', GIT_REPO . '.git');
define('GIT_CMD', GIT . ' --git-dir=' . GIT_DIR . ' ');
@dprevite
dprevite / gist:3702510
Created September 11, 2012 22:11 — forked from brianseitel/gist:1495488
SimpleXML to Array
function simplexml_to_array($simplexml_object) {
$array = array();
$children = $simplexml_object->children();
$executed = false;
foreach ($children as $elementName => $node) {
if ($array[$elementName] != null) {
if ($array[$elementName][0] !== null) {
$i = count($array[$elementName]);
simplexml_to_array($node, $array[$elementName][$i]);
} else {
@dprevite
dprevite / flash_message_helper.php
Created August 9, 2012 17:59
flash_message_helper.php
<?php
/**
* Set a flash message to be displayed
*
* @param string $type The type of message, used for styling (error|success|warning|information)
* @param string $message The message to be displayed
*
* @return void
@dprevite
dprevite / jenkins.css
Created June 21, 2012 18:52
Jenkins CSS
@charset "utf-8";
#main-table {
background-image: none !important;
}
@dprevite
dprevite / file_permissions.sh
Created June 18, 2012 20:32
Reset Apache file permissions
find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;
@dprevite
dprevite / farmlint.php
Created May 9, 2012 16:05
PHP Farm Linting for each installed version of PHP
#!/usr/bin/php
<?php
define('PHPFARM_BIN_PATH', '/home/dprevite/phpfarm/inst/bin/'); // WITH trailing slash
define('NL', "\n");
/**
* undocumented function
*
@dprevite
dprevite / dump_tables.php
Created February 12, 2012 07:41
Dump every table from every database into its own sql file (Fancy PHP version)
#!/usr/bin/php
<?php
// Install these with PEAR
require_once 'Console/CommandLine.php';
require_once 'Console/Color.php';
require_once 'Console/ProgressBar.php';
define('NL', "\n");