Skip to content

Instantly share code, notes, and snippets.

@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;
@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 / 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 / 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'
INFO global: Vagrant version: 1.2.1
DEBUG global: Loading core plugin: /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.1/plugins/commands/box/plugin.rb
INFO manager: Registered plugin: box command
DEBUG global: Loading core plugin: /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.1/plugins/commands/destroy/plugin.rb
INFO manager: Registered plugin: destroy command
DEBUG global: Loading core plugin: /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.1/plugins/commands/halt/plugin.rb
INFO manager: Registered plugin: halt command
DEBUG global: Loading core plugin: /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.1/plugins/commands/init/plugin.rb
INFO manager: Registered plugin: init command
DEBUG global: Loading core plugin: /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.1/plugins/commands/package/plugin.rb
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index a9de8c8..ac71a38 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -63,7 +63,7 @@ prompt_context() {
local user=`whoami`
if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
- prompt_segment black default "%(!.%{%F{yellow}%}.)$user@%m"
+ prompt_segment 252 default "%(!.%{%F{yellow}%}.)$user@%m"
@kid-icarus
kid-icarus / gist:7684435
Created November 27, 2013 22:45
For jorybro
var derp = {foo: 3, bar: 3};
var merp= [];
console.log(derp);
for (var name in derp) {
if (derp.hasOwnProperty(name)) {
for (var i = 0; i < derp[name]; i++) {
merp.push(name);
}
}
(function() {
var WAITFORIT;
// style objects for styles bc lazy
var divstyles = {
'width' : '300px',
'height' : '150px',
'backgroundColor' : '#fff',
'position' : 'fixed',
<?php
/**
* Callable typehints are only supported in php >= 5.4.
*
* For PHP 5.3, remove callable typehint, use is_callable($callback) instead.
*/
/**
* Returns true if the given predicate is true for all elements.
*/
function voff() {
DATVM=`VBoxManage list runningvms | awk '{gsub(/"/, "", $1); print $1}'`
VBoxManage controlvm $DATVM poweroff
}