Skip to content

Instantly share code, notes, and snippets.

View adnasa's full-sized avatar
💐

Adnan Asani adnasa

💐
View GitHub Profile
@adnasa
adnasa / gist:6411938
Last active December 22, 2015 03:39
Git alias, baby!
[alias]
d = "diff --unified=10"
sh = "show --unified=10"
st = "status"
co = "checkout"
m = "merge"
ls = "log --pretty=format:\"%C(yellow)%h %C(blue)%ad%C(red)%d %C(reset)%s%C(green) [%cn]\" --decorate --date=short"
standup = "log --since '1 day ago' --oneline --author <adnan@netconsult.se>"
br = "branch"
bra = "branch -a"
@adnasa
adnasa / gist:6949658
Created October 12, 2013 12:45
Drupal 7 update password
drush upwd admin --password=drupal
@adnasa
adnasa / gist:8454699
Created January 16, 2014 13:06
Create folder with todays date
mkdir `date +%y-%m-%d`
@adnasa
adnasa / gist:9066686
Created February 18, 2014 08:14
merge HEAD of file from another branch
$: git checkout A
$: git checkout --patch B f
@adnasa
adnasa / index.base.php
Created March 21, 2014 13:49
Base index for silex.
<?php
require_once __DIR__.'/../vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
$app = new Silex\Application();
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
'translator.messages' => array(),
@adnasa
adnasa / gist:c5eaf4a31a8e8da91516
Created May 28, 2014 09:40
VIM: normal mode new line
nmap <S-Enter> o<Esc> " new NEXT line in normal mode
nmap <S-Backspace> O<Esc> " new PREVIOUS line in normal mode
@adnasa
adnasa / gitignore_global
Created August 29, 2014 08:15
My gitignore.
# Custom stuff
# Added to my repo
cscope.*
tags
phpcd.phar
private
# IDEs and code-editors
.idea
@adnasa
adnasa / live templates
Last active August 29, 2015 14:05
unit-testing snippets
# pstorm
_ac
$this->assertCount($START$, $COUNTABLE$); $END$
_at
$this->asserTrue($START$, $BOOLEAN$); $END$
_e
$this->asserEquals($START$, $CHECK_EQUAL$); $END$
_ins
$this->assertInstanceOf('$START', $INSTANCE$); $END$
@adnasa
adnasa / index.js
Created October 18, 2014 15:54
get the file-extension
var nodePath = require('path');
/**
* @param string filePath
* @return string filePath[extension]
*/
var getFileExtension = function(filePath) {
var extension = nodePath.extname(filePath||'').split('.');
return extension[extension.length - 1];
};
@adnasa
adnasa / login.js
Created November 6, 2014 22:11
Login into a system
var casper = require('casper').create();
var utils = require('utils');
var URL_LOGIN = "";
var URL_AUTH = "";
var AUTH_TOKEN = null;
var AUTH_EMAIL = null;
var AUTH_PASS = null;
casper.start(URL_LOGIN, function() {