Skip to content

Instantly share code, notes, and snippets.

View mechastorm's full-sized avatar

Shih Oon Liong mechastorm

View GitHub Profile
@mechastorm
mechastorm / gist:e1e4867e21987cd78342
Created January 28, 2015 05:13
Example of adding a pre-commit hook to your .pre-commit-config.yml
- repo: http://source/to/your/hook/repo/url
sha: master
hooks:
- id: php-lint
@mechastorm
mechastorm / php_lint_hook.yml
Created January 28, 2015 05:11
Pre-commit hook Yaml to run PHP syntax check against staged files before commit.
- id: php-lint
name: PHP Syntax Check (Quick)
description: Runs php -l on all staged files. Exits when it hits the first
errored file
entry: php -l
language: system
files: \.php$
@mechastorm
mechastorm / cron_install.xml
Last active December 20, 2015 04:18
Phing task to install Cron Job Config. Must run with sudo
<!--
TargetName: cron:install
Partly based on http://codeinthehole.com/writing/deploying-cron-jobs-using-phing/
@param env.name The env name
@env.config_path Path in project for the env configs
@param project.folder AKA the name of the project
-->
<target name="cron:install" description="Install Cron Job Config. Run with sudo">
<property name="cron_source_path" value="${env.config_path}/system/cron.d" />
@mechastorm
mechastorm / install_ansible.sh
Created June 5, 2013 04:08
Bash Shell script to install Ansible via Git
#!/usr/bin/env bash
# Usage Example:
# ./install_ansible.sh 'v1.1' path/to/local/ansible/hosts/file
# Look up https://github.com/ansible/ansible for version tags to use
versionTag=$1
ansibleHosts=$2
# Install Git
---
# Attempt to check if the folder exist.
# If it exist echo out a string. You have to echo something
# if the directory does exist or else the task is considered failed
# Output is set to $is_default_created. Note that this variable is
# object and not an atomic value.
- name: Attempt to check if a directory exist
action: shell test -d /my/folder && echo "exist" || echo ""
register: is_folder_created
@mechastorm
mechastorm / FB Locale List
Created September 4, 2012 21:27
List of locales supported by Facebook. These are the same supported locales that you can only call when loading the FB JS SDK
<?php
/**
* List of locales supported by Facebook.
*
* These are the same supported locales that you can only call when loading the FB JS SDK at
* //connect.facebook.net/{LOCALE_ID}/all.js
*
* Locales taken from http://www.facebook.com/translations/FacebookLocales.xml
*
* Last Updated: 04/09/2012