Skip to content

Instantly share code, notes, and snippets.

@kid-icarus
kid-icarus / git aliases
Last active December 16, 2015 07:38
My emm effing git aliases
alias g=git
alias ga='git add'
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias 'gc!'='git commit -v --amend'
alias gca='git commit -v -a'
alias 'gca!'='git commit -v -a --amend'
alias gcl='git config --list'
alias gcm='git checkout master'
@kid-icarus
kid-icarus / gist:4142925
Created November 25, 2012 09:32
Ascii Art
%r _____ __ %n%y ________ .__ %n
%r / _ \_/ |_ ____ ____ %n%y \______ \ ____ _____|__| ____ ____ %n
%r / /_\ \ __\/ __ \ / \ %n%y | | \_/ __ \ / ___/ |/ ___\ / \ %n
%r/ | \ | \ ___/| | \%n%y | ` \ ___/ \___ \| / /_/ | | \%n
%r\____|__ /__| \___ |___| /%n%y /_______ /\___ )____ |__\___ /|___| /%n
%r \/ \/ \/ %n%y \/ \/ \/ /_____/ \/ %n
%w ________
/ _____/______ ____ __ ________
/ \ __\_ __ \/ _ \| | \____ \
\ \_\ \ | \( |_| ) | / |_| )
@kid-icarus
kid-icarus / gist:4126352
Created November 21, 2012 17:38
recursive slam dunk
/**
* Adds an #ajax property recursively to all elements of a form.
*
* @param array $element
* The first element to recursively apply #ajax to.
*/
function recursive_ajax(&$element) {
if (element_children($element)) {
foreach (element_children($element) as $child) {
recursive_ajax($element[$child]);
@kid-icarus
kid-icarus / regex.php
Created July 31, 2012 23:39
For lindsayo
<?php
$matches = array();
$string = ' one two';
$number_of_matches = preg_match('/\s*(.*)/', $string, $matches);
print_r($matches);
$replacement_awesomeness = preg_replace('/\s/','-', $matches['1']);
print $replacement_awesomeness;