Skip to content

Instantly share code, notes, and snippets.

💭
Set your status

Furkan Mustafa furkanmustafa

💭
Set your status
Block or report user

Report or block furkanmustafa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@furkanmustafa
furkanmustafa / collectionOrder.js
Last active Aug 29, 2015
Simple routines for ordering database data in javascript
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;
}
};
@furkanmustafa
furkanmustafa / timezone_stack.php
Last active Aug 29, 2015
Easy push/pop default timezone stack for php
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();
}
@furkanmustafa
furkanmustafa / .tmux.conf
Created Oct 11, 2014
Tmux configuration
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
@furkanmustafa
furkanmustafa / gitcommit.nanorc
Created Jul 28, 2015
Git Commit nanorc file with diff/patch support
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
@furkanmustafa
furkanmustafa / iwscan.py
Created May 28, 2014
iwlist scan parser for python
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')
@furkanmustafa
furkanmustafa / play-random-music.sh
Last active Nov 12, 2015
A simple script to play random mp3s in a folder
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
@furkanmustafa
furkanmustafa / php-query-string.php
Last active Dec 14, 2015
PHP Functions for parsing & building query strings, in a better way than http_build_query or parse_str does.
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 {
@furkanmustafa
furkanmustafa / onMainQueue.mm
Last active Dec 17, 2015
simple function for running UI Updates (or anything) on main thread for Cocoa. Can be useful if you have a callback you are not sure it always runs on main thread.
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(^{
@furkanmustafa
furkanmustafa / FMConfigurationManager.php
Last active Dec 17, 2015
Simple JSON Configuration Manager
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
You can’t perform that action at this time.