Instantly share code, notes, and snippets.

View collectionOrder.js
var collectionOrder = function(options) {
this.itemCount = options.itemCount;
this.move = options.move;
this.fetch = options.fetch;
if (typeof options.batchMove !== "undefined") {
this.batchMove = options.batchMove;
} else {
this.batchMove = this._batchMoveInternal;
}
};
View timezone_stack.php
<?php
// Timezone Stack https://gist.github.com/furkanmustafa/8710c43ba8299ca10a32
class TimezoneStack {
public static $stack = [];
static function Init() {
self::$stack[] = @date_default_timezone_get();
}
View .tmux.conf
#### 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
View better-pmset-values
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
View gitcommit.nanorc
# 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
View iwscan.py
#!/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')
View play-random-music.sh
#!/bin/bash -e
PLAYER="mpv -vo null"
#PLAYER="mpg321"
MUSIC=$(find . -regextype posix-extended -iregex '.*(m4a|mp3|mp4|aac)$' | sort -R)
IFS=$'\n'
for file in $MUSIC
View php-query-string.php
<?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 {
View onMainQueue.mm
void onMainQueue(void(^block)(void)) {
if ([NSThread isMainThread])
block();
else
dispatch_sync(dispatch_get_main_queue(), block);
}
//usage example:
- (void)callbackThatIDontKnowWhichThreadIsItRunningOn {
onMainQueue(^{
View FMConfigurationManager.php
<?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