Skip to content

Instantly share code, notes, and snippets.

View d1rk's full-sized avatar
🖖
Live long and prosper!

Dirk Brünsicke d1rk

🖖
Live long and prosper!
View GitHub Profile
@hubgit
hubgit / ElasticSearch.php
Created February 16, 2010 17:20
ElasticSearch class for PHP
<?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)
*
@predominant
predominant / changelog-cakephp.php
Created November 1, 2010 15:23
Automatically generate changelogs for CakePHP
<?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"}\'',
@tpope
tpope / css.vim
Created January 2, 2011 05:42
Nikolai's fix to nested closing curly brace indenting
" 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
@badsyntax
badsyntax / build.sh
Created January 11, 2011 20:56
An example PHP & BASH Post-Receive github web hook to package projects
#! /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
@fahad19
fahad19 / Navigation.php
Created November 23, 2011 02:34
Admin navigation management in Lithium PHP framework
<?php
/**
* Navigation class for storing admin panel menu.
*
* @author Fahad Ibnay Heylaal <contact@fahad19.com>
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace core\storage;
use core\util\Set;
@d1rk
d1rk / auth.conf
Created November 28, 2011 13:50
setup
AuthUserFile :vhosts/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
<Limit GET>
require user d1rk
@saetia
saetia / gist:1623487
Last active July 16, 2024 05:56
Clean Install – OS X 10.11 El Capitan

OS X Preferences


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
@ziadoz
ziadoz / awesome-php.md
Last active July 13, 2024 05:29
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@xeoncross
xeoncross / blowfish.php
Created April 17, 2012 16:09
blowfish hashing using PHP's crypt and mcrypt library
<?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)));
}