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 / mem.class.php
Last active Dec 17, 2015
Easy to use memcache proxy class for php
View mem.class.php
Memcache Proxy Class for data
Furkan Mustafa, 2013.05
use it.
$dataUsedTooMuch = mem::cache('myhandle', 30, function() {
return db::query('SELECT CRAZY SLOW SQL SCRIPT');
furkanmustafa / nonBreakingExplode.php
Created Jul 20, 2013
Replacement for php's built-in explode function, doesn't break quotes, etc.
View nonBreakingExplode.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();
furkanmustafa /
Created Jul 20, 2013
Shell script to be used in build phases in xCode, so it will inject git revision and stuff into bundle
BUILD_NUMBER=`git rev-parse --short HEAD`
git update-index -q --refresh
CHANGES=$(git diff-index --name-only HEAD --)
if [ ! -z "${CHANGES}" ]; then
if [ "${CONFIGURATION}" == "Debug" ]; then
git diff --color | tools/ --bg=dark > gitdiff.html
View UIImage+Retina4.h
// 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 / NSString+FMAdditions.h
Created Nov 30, 2013
NSString Categories for localization, formatting, regex
View NSString+FMAdditions.h
// 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 / NSString+FMNumberFormatter.m
Created Dec 18, 2013
NSString category for formatting numbers easily with optional NSNumberFormatter settings as block
View NSString+FMNumberFormatter.m
// use it. get rid of `autorelease` if using arc.
// .h file
@interface NSString (FMNumberFormatter)
+ (NSString *)stringByFormattingNumber:(NSNumber*)number
formatterSettings:(void(^)(NSNumberFormatter* formatter))settingsBlock;
furkanmustafa / php-html-attr-parser.php
Created Nov 27, 2012
php script for parsing html element attributes
View php-html-attr-parser.php
//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;
furkanmustafa / async_controller.rb
Last active Feb 10, 2016
Sample Asynchronous action code for rails
View async_controller.rb
# FROM: @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
furkanmustafa /
Created Apr 22, 2016
Quickly start an iso with qemu (kvm)
#!/bin/sh -e
exec qemu-system-x86_64 -enable-kvm -cdrom $1 -m 1024
furkanmustafa /
Last active Aug 3, 2016
A draft rancher management script using bash and jshon
#!/bin/sh -e
# set -x
PROJECT_ID="1a5" #id of my stack in rancher
You can’t perform that action at this time.