This file contains 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 | |
// a replacement for php's built-in explode function, doesn't break quotes, etc. | |
function nonBreakingExplode($delimiter, $string, $nobreakChars = array('"', '\'', '()', '[]')) { | |
$pos = 0; | |
$len = strlen($string); | |
$delimiterLen = strlen($delimiter); | |
$lastCut = 0; | |
$nest = array(); |
This file contains 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
#!/bin/bash | |
BUILD_NUMBER=`git rev-parse --short HEAD` | |
git update-index -q --refresh | |
CHANGES=$(git diff-index --name-only HEAD --) | |
if [ ! -z "${CHANGES}" ]; then | |
BUILD_NUMBER="${BUILD_NUMBER}+" | |
if [ "${CONFIGURATION}" == "Debug" ]; then | |
git diff --color | tools/ansi2html.sh --bg=dark > gitdiff.html | |
cp ${PROJECT_DIR}/gitdiff.html ${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH} | |
fi |
This file contains 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
// | |
// UIImage+Retina4.h | |
// StunOMatic | |
// | |
// Created by Benjamin Stahlhood on 9/12/12. | |
// Copyright (c) 2012 DS Media Labs. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
This file contains 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
// | |
// NSString+FMAdditions.h | |
// Use it. maybe keep a link to the author or sth. | |
// | |
#import <Foundation/Foundation.h> | |
// StringWithFormat Shorthand | |
#define f(format, ...) [NSString stringWithFormat:(format), ##__VA_ARGS__] |
This file contains 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
// use it. get rid of `autorelease` if using arc. | |
// | |
// .h file | |
@interface NSString (FMNumberFormatter) | |
+ (NSString *)stringByFormattingNumber:(NSNumber*)number | |
formatterSettings:(void(^)(NSNumberFormatter* formatter))settingsBlock; | |
@end |
This file contains 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 | |
// TEST | |
//print_r(getTagAttributes('<img enabled href=/fuck/my/attr/syntax" disabled id="idofmyelemtnt" title="Incredible Web Site" src="/images/incredibility.jpg" style="height:300px;width:900px;" />')); | |
function getTagAttributes($htmlortag, $name = false) { // name=false returns all attributes as array | |
$p = 0; | |
$tag = false; | |
$inquote = false; | |
$started = false; |
This file contains 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
# FROM: http://www.jonb.org/2013/01/25/async-rails.html @jbaudanza | |
# Modified to get it working. | |
module AsyncController | |
# This is the rack endpoint that will be invoked asyncronously. It will be | |
# wrapped in all the middleware that a normal Rails endpoint would have. | |
class RackEndpoint | |
attr_accessor :action |
This file contains 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
#!/bin/sh -e | |
exec qemu-system-x86_64 -enable-kvm -cdrom $1 -m 1024 |
This file contains 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
#!/bin/sh -e | |
# set -x | |
RANCHER_URL="rancher.mydomain.com" | |
PROJECT_ID="1a5" #id of my stack in rancher | |
CATTLE_ACCESS_KEY=MY_RANCHER_ACCESS_KEY | |
CATTLE_SECRET_KEY=MY_RANCHER_ACCESS_SECRET | |
TMP_FILE=$(mktemp) |
This file contains 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
set -g default-terminal "screen-256color" | |
#set -g history-limit 10000 | |
#set -g mode-mouse on | |
#set -g terminal-overrides 'xterm*:smcup@:rmcup@' | |
#set -g mouse-select-pane on | |
#set -g mouse-select-window on | |
#set -g mouse-resize-pane on | |
bind -n WheelUpPane copy-mode | |
bind -n S-down new-window |