Skip to content

Instantly share code, notes, and snippets.

View mirfan's full-sized avatar
💭
I may be slow to respond.

Mohammed Irfan mirfan

💭
I may be slow to respond.
View GitHub Profile
@mirfan
mirfan / agile-git.sh
Created November 11, 2013 13:21 — forked from nz/agile-git.sh
# zsh shell functions for working in local git branches and rebasing appropriately
function rebase {
if [[ $1 == "" ]]; then master='master'; else master=$1; fi
branch=`git branch | grep \* | awk '{print $2}'` &&
git co $master && git pull && git rebase $master $branch
}
function push {
if [[ $1 == "" ]]; then master='master'; else master=$1; fi
@mirfan
mirfan / index.php
Created February 4, 2013 03:38 — forked from Chase-san/index.php
<?php /* Copyright(c) 2013 Robert Maupin. Released under the ZLIB License. */
if(count($_FILES) > 0) {
extract($_FILES['file']);
list($w,$h,$type)=getimagesize($tmp_name);
/*see exif-imagetype() documentation :) */
if(!$type||$type>3||filesize($tmp_name)>1024*200)
exit();
$ext=image_type_to_extension($type,false);
$md5=md5_file($tmp_name);
move_uploaded_file($tmp_name,$n="img/$md5.$ext");