Skip to content

Instantly share code, notes, and snippets.

@sams
sams / installer
Last active December 15, 2018 21:53
dotfile install
#!/usr/bin/env bash
[[ "$1" == "source" ]] || \
echo 'Dotfiles - "sams" Sam Sherlock - http://samsherlock.com/'
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
Usage: $(basename "$0")
See the README for documentation.
@sams
sams / LnShell.php
Created October 18, 2012 11:48 — forked from nojimage/ln.php
CakePHP LnShell - create plugin webroot symlink
<?php
/**
* Create symlink plugins and themes webroot to APP/webroot/
*
* updated for CakePHP 2.x by sams
* PHP versions 5
*
* Copyright 2011, nojimage (http://php-tips.com/)
*
@sams
sams / prompt
Created October 9, 2012 13:27
dual line color prompt with date & gitstatus
### PROMPT ###
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@sams
sams / .htaccess
Created May 6, 2011 08:18
BakingPlate .htaccess revision
###
### BakingPlate adapting .htaccess from Html5 Boilerplate for use with CakePHP
###
# Media Temple
### Action php5-script /gs-bin/php5-latest
### AddHandler php5-script .php
# 1&1
### AddType x-mapp-php5 .php
@sams
sams / CssMin.php
Created April 10, 2011 02:33
cssmin by Joe Scylla from Googlecode (this gist is used by BakingPlate to git the code)
<?php
/**
* CssMin - A (simple) css minifier with benefits
*
* --
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
@sams
sams / plate.php
Created February 25, 2011 02:44
to reduce the complexity of bakingplates layouts; keep'em clean
<?php
class PlateHelper extends AppHelper {
var $helpers = array('Html', 'Form');
/*
* function js_lib
* @param host = google, lib = jquery, version = null, compressed = true
@sams
sams / gist:799633
Created January 28, 2011 01:11
Komodo Macro to reformat a selection of markup within a mixed html/php file
// Aim to expand this to work with cake ctp files to reformat (just an idea)
// has issues if tag attribs are echo'd
// does not indent; the origin might
// set the path to tidy back to env var
// the origin - http://community.activestate.com/forum/code-beautifier-mixed-htmlphp
var ke = komodo.editor
if (komodo.view.scintilla) { komodo.view.scintilla.focus(); }
var currentPos = komodo.editor.currentPos;
try {
var tidycmd = 'c:\\tidy.exe --input-xml y --indent auto --indent-spaces 2 --new-pre-tags textarea --wrap-php n --wrap 0 --break-before-br y --show-body-only auto --doctype auto --show-warnings n --quiet y';
(function() {
/*****************************************************************************
* Aims: (as yet untested) *
* Use sass-convert and add support for Scss *
* Dont rely on cygwin - option to use msysgit *
* *
* *
* EDIT CONSTANTS BELOW TO MATCH YOUR MACHINE SETUP *
* *
(function() {
/*****************************************************************************
* Aims: (as yet untested) *
* Use sass-convert and add support for Scss *
* Dont rely on cygwin - option to use msysgit *
* *
* *
* EDIT CONSTANTS BELOW TO MATCH YOUR MACHINE SETUP *
* *