Skip to content

Instantly share code, notes, and snippets.

View adnasa's full-sized avatar
💐

Adnan Asani adnasa

💐
View GitHub Profile
@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 / 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() {
@adnasa
adnasa / discograph-qtip.js
Last active August 29, 2015 14:08
quick and dirty hack to get the discography list from an artist in wikipedia :D
var _ = require('underscore')._;
var casper = require('casper').create({
clientScripts: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/underscore/underscore.js'
],
verbose: true,
logLevel: 'debug'
});
@adnasa
adnasa / artistAlbumsToMarkdown.js
Created November 16, 2014 20:35
Quick play with nodejs fs module
var fs = require('fs');
var _ = require('underscore')._;
var artists = [{
name: 'Raphaeel Saadiq',
album: [
'Instant Vintage'
]
}, {
/*! Js Pub/Sub
* http://anasnakawa.com/
* Copyright (c) Anas Nakawa
* inspired by Ben Alman's one <https://gist.github.com/cowboy/661855>
* MIT License
*/
(function( p ) {
var e = p.e = {};
# whats up
alias whats="vagrant"