Skip to content

Instantly share code, notes, and snippets.

View anotheremily's full-sized avatar

emily anotheremily

  • Las Vegas, Nevada USA
View GitHub Profile
@anotheremily
anotheremily / zend_autoreply_detection.php
Created April 8, 2011 15:57
Auto-reply detection in PHP (with Zend)
<?php
/**
* See if it's an autoreply
* $message is of type Zend_Mail_Message
*/
$autoreply = false;
try {
if ($message->{'X-Autoreply'}) {
$autoreply = true;
}
@anotheremily
anotheremily / array_peek.php
Created September 2, 2011 14:46
array_peek
<?php
/**
* Peeks at the first element of an array. Optionally returns the first key
* if the 2nd parameter is set to true.
*
* @param Array $arr
* @param Boolean $returnKey
* @return Mixed $val
*/
function array_peek($arr, $key = false) {
@anotheremily
anotheremily / phplint.sh
Created April 6, 2012 19:15
PHP Lint Bash Functions
function phplint() {
for f in `ls *.php`
do
php -l ${f}
done
}
function rphplint() {
for f in `find . -iname '*.php'`
do
@anotheremily
anotheremily / loc.sh
Created April 6, 2012 19:53
recursive line count
#!/bin/bash
# searches for php files. change find command to change what it searches for.
function loc() {
tloc=0
for f in `find . -iname '*.php'`
do
cloc=`wc -l ${f}`
tloc=$((${tloc} + `echo ${cloc} | cut -d' ' -f1`))
echo ${cloc}
@anotheremily
anotheremily / vagrant-setup.sh
Created August 13, 2012 21:46
Default Vagrant Setup
#!/bin/bash
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential php5 apache2 mysql-server git vim python-software-properties nodejs npm ruby-sass php5-mysql
sudo npm install -g requirejs
sudo a2enmod rewrite
@anotheremily
anotheremily / Coffee Sheets Example.md
Last active December 14, 2015 22:19
CoffeeSheets Example - Literate Example

Stylesheet for [name of project]

These are the main styles for the home page

class CoffeeSheetsExampleBaseClass extends CoffeeSheetStyleSheet {

This will execute on every page load generating beautiful styles for all!

   public void main () {
@anotheremily
anotheremily / gist:6173974
Created August 7, 2013 13:21
Force 80 Character Lines in Vim
Set textwidth to 80, move to the start of the file (can be done with Ctrl-Home or gg), and type gqG.
gqG formats the text starting from the current position and to the end of the file. It will automatically join consecutive lines when possible. You can place a blank line between two lines if you don't want those two to be joined together.
(http://stackoverflow.com/questions/3033423/vim-command-to-restructure-force-text-to-80-columns)
### Keybase proof
I hereby claim:
* I am zyoung on github.
* I am zyoung (https://keybase.io/zyoung) on keybase.
* I have a public key whose fingerprint is 5C1F 2DA9 67AB 040A 2640 FCA8 AE3C 5206 DBC6 9F8C
To claim this, I am signing this object:
@anotheremily
anotheremily / .sh
Created February 5, 2016 21:24
Switch between Xcode compilers.
$> xcode-select -p
/Library/Developer/CommandLineTools
$> sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
@anotheremily
anotheremily / templater.sh
Created June 6, 2016 14:35
Simple Templater in Bash
#!/bin/bash
TEMPLATE_DIR='src/templates/'
PAGE_DIR='src/pages/'
DEST_DIR='src/'
for page in `ls ${PAGE_DIR}`
do
echo ${page}
contents=`cat ${PAGE_DIR}${page}`