Skip to content

Instantly share code, notes, and snippets.

View fideloper's full-sized avatar
🏠
Working from home

Chris Fidao fideloper

🏠
Working from home
View GitHub Profile
@fideloper
fideloper / h5bp.sh
Created December 27, 2011 20:18
Download and setup basic h5bp from github.com
#!/usr/bin/bash
git clone https://github.com/paulirish/html5-boilerplate.git
cd html5-boilerplate
git checkout v2.0stripped
@fideloper
fideloper / application.ini
Created January 20, 2012 15:53
Zend Translate
resources.locale.default = "en_US"
resources.translate.content = APPLICATION_PATH "/../data/locales"
resources.translate.scan = "directory"
resources.translate.adapter = "csv"
resources.translate.delimiter = ","
resources.translate.default = "en"
;File localization structure example:
;
; project_root/data/locales/en/lang_en.csv
<?php
class IndexController extends Zend_Controller_Action
{
private $lang;
public function init() {
$this->lang = Zend_Registry::get('Zend_Translate');
@fideloper
fideloper / index.phtml
Created January 20, 2012 16:04
Sample view
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en" mlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en" mlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en" mlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@fideloper
fideloper / postdeploy.php
Created February 4, 2012 18:06
Beanstalk Post deploy hooks
<?php
$deploy_json = @file_get_contents('php://input');
if (!empty($deploy_json))
{
$deploy_data = json_decode($deploy_json);
//Log output to file (overwrites on each deploy). Make sure file is 0777
file_put_contents('results.txt', print_r($deploy_data, true));
@fideloper
fideloper / minify.sh
Created February 4, 2012 18:09
Minify with YUI shell script
# src: http://www.craig-russell.co.uk/bulk-minify-shell-script/
CSS='css'
JS='js'
FILELIST="minify.$$.tmp"
COMPORESSOR="yuicompressor-2.4.2.jar"
MINCSS="css/styles.min.css"
# Minify CSS to single file
echo -n '' > $MINCSS
@fideloper
fideloper / enclosures.js
Created April 13, 2012 13:53
More fun Javascript enclosures
Instead of the "traditional":
(function() {
})();
You can do:
!function(){
@fideloper
fideloper / perm.sh
Created April 24, 2012 18:57
Script for file permssion (Expressionengine)
#!/bin/bash
# Find location of this script.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#Standard permissions
find "$DIR"/ -type d -print0 | xargs -0 chmod 775
find "$DIR"/ -type f -print0 | xargs -0 chmod 664
#Alternatively 0777 these
@fideloper
fideloper / db_clone.sh
Created April 24, 2012 19:56
One database to another in one CLI call
mysqldump -u USER -pPASS DB_NAME | mysql -u USER -pPASS NEW_DB_NAME
@fideloper
fideloper / .htaccess
Created April 27, 2012 14:50
htaccess to display markdown only if file exists
#Turn on Rewrite
RewriteEngine On
#Check if requested file ends in .md or .markdown
RewriteCond $1 \.(md|markdown)$ [NC]
#Check if file exists
RewriteCond %{REQUEST_FILENAME} -f
#Rewrite so $_GET['file'] is available to PHP code