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
<?php | |
/* | |
Memcache Proxy Class for data | |
Furkan Mustafa, 2013.05 | |
use it. | |
usage: | |
$dataUsedTooMuch = mem::cache('myhandle', 30, function() { | |
return db::query('SELECT CRAZY SLOW SQL SCRIPT'); |
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 Simple JSON Site-wide Configuration manager with key-path access, overriding, inline variables, etc.. | |
* It might look ugly for some people, most important goal with this is simplicity in the code that uses this. | |
* | |
* You can find usage sample at the end of the file | |
* | |
* @author Furkan Mustafa <furkan@fume.jp> | |
* @version 0.1.3 |
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
void onMainQueue(void(^block)(void)) { | |
if ([NSThread isMainThread]) | |
block(); | |
else | |
dispatch_sync(dispatch_get_main_queue(), block); | |
} | |
//usage example: | |
- (void)callbackThatIDontKnowWhichThreadIsItRunningOn { | |
onMainQueue(^{ |
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 | |
function ParseQueryString($query, $orig = false) { | |
$items = $orig ? $orig : array(); | |
$_items = explode('&', $query); | |
foreach ($_items as $item) { | |
if (strpos($item, '=')===false) { | |
$items[urldecode($item)] = true; | |
} | |
else { |
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
#!/usr/bin/env python | |
# Based on http://ubuntuforums.org/showthread.php?t=984492&p=6193749#post6193749 | |
import subprocess | |
import re | |
proc = subprocess.Popen('iwlist scan 2>/dev/null', shell=True, stdout=subprocess.PIPE, ) | |
stdout_str = proc.communicate()[0] | |
stdout_list = stdout_str.split('\n') |
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
# Some parts from here : http://milianw.de/code-snippets/git-commit-message-highlighting-in-nano | |
# Some parts from here : https://github.com/serialhex/nano-highlight/blob/master/patch.nanorc | |
# syntax highlighting for git commit messages | |
syntax "patch" ".git/COMMIT_EDITMSG$" | |
# overlong lines | |
# color brightred "^.{70,}.+$" | |
# comment |
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
DestroyFVKeyOnStandby 1 | |
Active Profiles: | |
Battery Power -1* | |
AC Power -1 | |
Currently in use: | |
standbydelay 0 | |
standby 0 | |
halfdim 1 | |
hibernatefile /var/vm/sleepimage | |
darkwakes 0 |
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
#### COLOUR (Solarized 256) | |
# default statusbar colors | |
set-option -g status-bg colour235 #base02 | |
set-option -g status-fg colour136 #yellow | |
set-option -g status-attr default | |
# default window title colors | |
set-window-option -g window-status-fg colour244 #base0 | |
set-window-option -g window-status-bg default |
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 | |
// Timezone Stack https://gist.github.com/furkanmustafa/8710c43ba8299ca10a32 | |
class TimezoneStack { | |
public static $stack = []; | |
static function Init() { | |
self::$stack[] = @date_default_timezone_get(); | |
} |