Skip to content

Instantly share code, notes, and snippets.

View zeroasterisk's full-sized avatar

alan blount zeroasterisk

View GitHub Profile
@zeroasterisk
zeroasterisk / git-dev2master
Created September 13, 2011 20:04
git-dev2master save in your path, to make dev2master migrations one command
#!/bin/bash
# -----------------------------------------------------------
# super basic script to migrate dev to master
# script continues if all processes go correctly
# all step-results echoed to screen
#
# usage:
# git dev2master
#
# -----------------------------------------------------------
@zeroasterisk
zeroasterisk / example file download action, based on media view
Created September 16, 2011 16:19
cakephp file download action, hashed and refer-restricted
<?php
/**
* Action to download special assets
* example link to download <?php echo $this->Html->link('Link Text', array('action' => 'download', Security::hash('filedownloadsalt'.date('d').env('REMOTE_ADDR')), $filename), array('escape' => false)); ?>
* example URL to download <?php echo $this->Html->url(array('action' => 'download', Security::hash('filedownloadsalt'.date('d').env('REMOTE_ADDR')), $filename)); ?>
* @param string $hash
* @param string $filename
*/
function download($hash=null, $filename=null) {
#!/bin/bash
# Assumes you will have this file in the repo root level folder
SCRIPT="$(readlink -nf ${0#./})"
SCRIPTNAME="${0##*/}"
ROOTBASE="${SCRIPT%/*}"
cd $ROOTBASE
git submodule init && git submodule update
$ROOTBASE/app/cake bisect script
<?php
/**
* This tester is a great tool for testing something in an easy way to make git bisect work for you
* note: not part of the repo, so it's not overwritten by git
* @link http://book.git-scm.com/5_finding_issues_-_git_bisect.html
* @link http://alblue.bandlem.com/2011/07/git-tip-of-week-git-bisect.html
*/
class BisectShell extends Shell{
var $uses = array('Event', 'Util', 'Asset');
# test: return true/false
# ~rtomayko/.screenrc
# -------------------------------------------------------------------
# Settings
# -------------------------------------------------------------------
crlf off # No Microsoft linebreaks
startup_message off # bypass GPL notice (we're aware)
defscrollback 15000 # big scrollback
#shell bash # don't start login shells
shelltitle "" # no title by default - set in PS1
@zeroasterisk
zeroasterisk / uploaded_file.php
Created March 17, 2012 06:51
classes to help with UploadedFileXhr
<?php
/**
* Handle file uploads via XMLHttpRequest
*/
class UploadedFileXhr {
/**
* Save the file to the specified path
* @return boolean TRUE on success
*/
@zeroasterisk
zeroasterisk / litleRecyclerDate
Created March 23, 2012 13:46
litleRecyclerDate()
$recycle_date = null;
// if 305 (Expired Card) -- we alter the cc_expires on retries every 4 days
if ($response_code == 305 && $attempts < 5) {
$cc_expires_year_increment = 0;
if ($attempts==1) {
// increment expires year by 3 = ~30% fix
$cc_expires_year_increment = 3;
} elseif ($attempts==2) {
// increment expires year by 2 = ~20% fix
$cc_expires_year_increment = 2;
@zeroasterisk
zeroasterisk / gist:2171723
Created March 23, 2012 15:22
Sublime Text 2 - User Keybindings
[
// plugins
{ "keys": ["ctrl+shift+t"], "command": "whitespacecorrector" },
{ "keys": ["ctrl+x"], "command": "clipboard_manager_cut" },
{ "keys": ["ctrl+c"], "command": "clipboard_manager_copy" },
{ "keys": ["ctrl+v"], "command": "clipboard_manager_paste", "args": { "indent": true } },
{ "keys": ["ctrl+alt+v"], "command": "clipboard_manager_paste", "args": { "indent": false } },
{ "keys": ["ctrl+shift+v"], "command": "clipboard_manager_choose_and_paste" },
{ "keys": ["ctrl+i", "ctrl+alt+v"], "command": "clipboard_manager_next_and_paste" },
{ "keys": ["ctrl+i", "ctrl+shift+v"], "command": "clipboard_manager_previous_and_paste" },
@zeroasterisk
zeroasterisk / xcache.ini
Created March 27, 2012 13:46
xcache ini example
; configuration for php Xcache module
[xcache-common]
;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
zend_extension = /usr/lib/php5/20090626/xcache.so
[xcache.admin]
xcache.admin.auth = On
xcache.admin.user = "appadmin"
;xcache.admin.pass = md5(yourpassword)
@zeroasterisk
zeroasterisk / post-checkout
Created April 13, 2012 17:53
a post checkout git-hook to automatically re-run compass compile : .git/hooks/post-checkout
#!/usr/bin/perl
use strict;
use warnings;
my ($previous_head, $current_head, $is_branch_checkout) = @ARGV;
my ($is_on_facelift, $run_compass) = 0;
if ($is_branch_checkout) {
$is_on_facelift = `git branch | grep -e "^\*.*facelift"`;
chomp $is_on_facelift;