Skip to content

Instantly share code, notes, and snippets.

View a7madgamal's full-sized avatar

Ahmed Hassanein a7madgamal

View GitHub Profile
@a7madgamal
a7madgamal / packages.cson
Created April 27, 2016 16:47
export file for atom's package sync
packages: [
"atom-beautify"
"atom-jade"
"atom-pair"
"autocomplete-paths"
"chary-tree-view"
"code-links"
"coffee-links"
"coffee-paste"
"editor-background"
@a7madgamal
a7madgamal / packages.cson
Created April 27, 2016 16:47
export file for atom's package sync https://atom.io/packages/package-sync
packages: [
"atom-beautify"
"atom-jade"
"atom-pair"
"autocomplete-paths"
"chary-tree-view"
"code-links"
"coffee-links"
"coffee-paste"
"editor-background"
#create hook script: /path/to/git/bare/repo/post-receive
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "pulling master"
git --work-tree=/path/to/working/dir --git-dir=/path/to/working/dir/.git pull origin master
else
kill -9 $(lsof -i:PORT_NUMBER -t)
#!/bin/bash
fromExt=".jade"
toExt=".pug"
for file in $(find . -name '*'$fromExt);
do
mv -i -v "$file" "${file%$fromExt}$toExt"
done
@a7madgamal
a7madgamal / style.js
Last active September 16, 2016 10:08
Douglas crockford's js library coding style (not usable, learning purposes only)
var ADSAFE;
ADSAFE = (function () {
"use strict";
function error(message) {
ADSAFE.log("ADsafe error: " + (message || "ADsafe violation."));
}
return {
get: function (object, name) {
@a7madgamal
a7madgamal / reverse.sh
Created September 21, 2016 16:53
Reverse a stash apply
git stash show -p | git apply --reverse

Go to the .git folder in your repo and open the file config. In the [core]section add the line

sparsecheckout = true then go to the folder .git/info and create the file sparse-checkout. Add something like

!this/path/will/be/ignored/* You should now be able to checkout the repo.

@a7madgamal
a7madgamal / git.sh
Created October 13, 2016 10:17
git tricks
#This will show the largest files at the bottom (fourth column is the file (blob) size.
git ls-tree -r -t -l --full-name HEAD | sort -n -k 4
@a7madgamal
a7madgamal / cls
Last active October 27, 2016 12:00
REAL cls for linux
# Use this command to do a terminal clear screen instead of just adding new lines ...
printf "\033c"
# alias it as cls
alias cls='printf "\033c"'
# \033 == \x1B == 27 == ESC
# this becomes <ESC>c which is the VT100 escape code for resetting the terminal.