This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# A Git pre-commit hook that checks for syntax errors | |
# for: Ruby, JavaScript, Python, Bash, and (Cake)PHP | |
# based on the extensions of staged files in Git. | |
# Can be 'installed globally' as of Git 1.7.1 using init.templatedir | |
# | |
# Copyright 2013, kvz (http://twitter.com/kvz) | |
# | |
# Some common caveats have been taken care of: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubuntu@beth:/tmp$ time dig @4.2.2.2 +time=3 +tries=1 +short tmp.transloadit.com.s3.amazonaws.com | |
s3-1-w.amazonaws.com. | |
205.251.243.73 | |
real 0m0.079s | |
user 0m0.004s | |
sys 0m0.000s | |
ubuntu@beth:/tmp$ time dig @8.8.8.8 +time=3 +tries=1 +short tmp.transloadit.com.s3.amazonaws.com | |
;; connection timed out; no servers could be reached |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Executing ruby in a template in ruby | |
version=$(curl -s 'http://localhost:9200' | ruby -rubygems -e 'require "json"; print JSON.parse(STDIN.read)["version"]["number"]') | |
echo -e "\033[1;37;46melasticsearch $version running with PID $pid\033[0m" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In PHP 5.4 you can pass JSON_UNESCAPED_UNICODE and JSON_UNESCAPED_SLASHES to json_encode: | |
$input = array('file' => '/\intro_cropsic – .m4v'); | |
$paramsString = json_encode($input, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | |
// And that will encode arrays with unicode characters more compatible with JavaScript. | |
// (e.g. it will produce the same sha1 if you phpjs.utf8_encode paramString in JavaScript ) | |
// On PHP 5.3 and lower, you may want to try | |
function json_encode_noescape_slashes_unicode ($arr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Class SomeClass() { | |
public function retry ($cb, $intervals = array(2, 4, 8, 16)) { | |
while ($intervals) { | |
if (!is_a($results = $cb(), 'Exception')) { | |
// good results, return them | |
return $results; | |
} | |
// failed, sleep for a larger & larger interval | |
$backoff = array_shift($intervals); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Be sure to checkout the official docs for a smaller example | |
# http://book.cakephp.org/2.0/en/installation/url-rewriting.html#pretty-urls-on-nginx | |
http { | |
# With this trick, you can pass per-environment variables and | |
# PHP settings to FastCGI depending on the host header value. | |
map $http_host $environment { | |
example.local development; | |
example.com production; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ls deps/packets |sed 's#\.sh##g' | |
aws | |
curl | |
exiftool | |
ffmpeg | |
ghostscript | |
go_cmds | |
gpac | |
haproxy | |
imagemagick |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# exiftool api2/test/fixture/file* \ | |
> |awk -F: '{print $1}' \ | |
> |sed 's/ *$//g' \ | |
> |grep -v === \ | |
> |sort -u \ | |
> |tr [A-Z' '\'\&\(\)] [a-z_____] > /tmp/meta.txt | |
# cat /tmp/meta.txt | |
about | |
add_original_decision_data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "My-New-Project", | |
"require-prod": { | |
"doctrine/orm": "2.2.1" | |
}, | |
"require-dev": { | |
"doctrine/orm": "2.*" | |
}, | |
"require":{ |