Skip to content

Instantly share code, notes, and snippets.

View furkanmustafa's full-sized avatar
💭
Set your status

Furkan Mustafa furkanmustafa

💭
Set your status
View GitHub Profile
@furkanmustafa
furkanmustafa / xCodeGitRevision.sh
Created July 20, 2013 14:27
Shell script to be used in build phases in xCode, so it will inject git revision and stuff into bundle
#!/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
//
// 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>
@furkanmustafa
furkanmustafa / NSDate+Formatters.h
Last active June 13, 2017 20:11
a few NSDateFormatter helpers for Objective-C
/* f@s2n.io */
// DateFormat Reference : http://www.unicode.org/reports/tr35/tr35-25.html#Date_Format_Patterns
#import <Foundation/Foundation.h>
extern NSString* const DATEFORMAT_RFC3339;
@interface NSDate (FMDateFormatters)
+ (NSDate*)dateWithString:(NSString*)dateString format:(NSString*)format locale:(NSLocale*)locale timezone:(NSTimeZone*)zone;
@furkanmustafa
furkanmustafa / NSString+FMAdditions.h
Created November 30, 2013 19:26
NSString Categories for localization, formatting, regex
//
// 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__]
@furkanmustafa
furkanmustafa / NSString+FMNumberFormatter.m
Created December 18, 2013 11:42
NSString category for formatting numbers easily with optional NSNumberFormatter settings as block
// use it. get rid of `autorelease` if using arc.
//
// .h file
@interface NSString (FMNumberFormatter)
+ (NSString *)stringByFormattingNumber:(NSNumber*)number
formatterSettings:(void(^)(NSNumberFormatter* formatter))settingsBlock;
@end
@furkanmustafa
furkanmustafa / collectionOrder.js
Last active August 29, 2015 13:57
Simple routines for ordering database data in javascript
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 August 29, 2015 14:01
Easy push/pop default timezone stack for 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 / iwscan.py
Created May 28, 2014 04:17
iwlist scan parser for python
#!/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 / .tmux.conf
Created October 11, 2014 03:47
Tmux configuration
#### 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
@furkanmustafa
furkanmustafa / watch-video.sh
Last active January 11, 2020 01:42
Simple script to watch streaming videos with mpv and youtube-dl
#!/bin/sh -e
#
# Public domain
# Author: roman [] tsisyk.com
# Modified By: furkan [] s2n.io 2014.10.19, added cache parameter and deleting cookie file
#
# Usage: ./me url [youtube-dl parameters]
#
TMPDIR=/tmp