most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
<?php | |
// http://www.elasticsearch.com/docs/elasticsearch/rest_api/ | |
class ElasticSearch { | |
public $index; | |
function __construct($server = 'http://localhost:9200'){ | |
$this->server = $server; | |
} |
<?php | |
App::import('Core', array('Media', 'HttpSocket')); | |
class UploadSocket extends HttpSocket { | |
/** | |
* upload function | |
* allows posting of multipart form data (aka file uploads) | |
* |
<?php | |
$options = array( | |
'repo' => '/Users/predominant/Projects/cakephp/2.0/.git', | |
'titleOrder' => array( | |
'dev', 'alpha', 'beta', 'rc', | |
), | |
'regex' => '/(?<version>[\d\.]+)(?:-(?<title>[a-zA-Z]+)(?:(?<iteration>\d)?))?/', | |
'formats' => array( | |
'plaintext' => '| awk \'{print "Commit: ["$1"]\n"; $1=""; print "-"$0"\n"}\'', | |
'lighthouse' => '| awk \'{print "#### Commit: ["$1"](http://github.com/cakephp/cakephp/commit/"$1")\n"; $1=""; print $0"\n"}\'', |
" Vim indent file | |
" Language: CSS | |
" Maintainer: Nikolai Weibull <now@bitwi.se> | |
" Latest Revision: 2010-12-22 | |
if exists("b:did_indent") | |
finish | |
endif | |
let b:did_indent = 1 |
#! /usr/bin/env bash | |
#clone the repo | |
git clone -q "${1}" "clones/${2}" | |
cd "clones/${2}" | |
#update the submodules (how do we handle errors here?) | |
git submodule --quiet update --init --recursive |
AuthUserFile :vhosts/.htpasswd | |
AuthGroupFile /dev/null | |
AuthName ByPassword | |
AuthType Basic | |
<Limit GET> | |
require user d1rk |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
# From my question and answer at SO: | |
# http://stackoverflow.com/questions/10183103/security-of-generating-hash-salts-using-phps-mt-rand | |
function blowfish($string, $salt = NULL, $iterations = '12') | |
{ | |
return crypt($string, $salt ?: "$2a\$$iterations$" . md5(mcrypt_create_iv(22, MCRYPT_DEV_URANDOM))); | |
} |