Skip to content

Instantly share code, notes, and snippets.

View hdragomir's full-sized avatar

Horia Dragomir hdragomir

View GitHub Profile
@hdragomir
hdragomir / about.md
Created August 10, 2011 20:32 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@hdragomir
hdragomir / .gitconfig
Created February 22, 2012 11:11
By Popular demand, my gitconfig file
[user]
name = Horia Dragomir
email = horia@hdragomir.com
[github]
user = hdragomir
[alias]
st = status -sb
ci = commit
co = checkout
p = push
@hdragomir
hdragomir / cd!.sh
Created March 23, 2012 13:29
Changes to a directory, creates it first if not already there. Saves me loads of headaches
function cd! {
mkdir $1
cd $1
}
@hdragomir
hdragomir / hack.sh
Created June 27, 2012 17:09 — forked from mrsimo/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2299719/hack.sh | sh
#
@hdragomir
hdragomir / dabblet.css
Created July 2, 2012 12:13
Weird behavior when combining opacity & z-index: -1
/**
* Weird behavior when combining opacity & z-index: -1
*/
div {
position: relative;
width: 200px; height: 200px;
background: yellowgreen;
/* Try commenting this or setting it to 1: */
@hdragomir
hdragomir / switch-default.js
Created October 10, 2012 11:54
Switch Default
switch (num) {
case 1:
'do your stuff';
break;
default:
case 2:
'do other stuff';
break;
case 3:
'more stuff';
@hdragomir
hdragomir / shadow-bars.html
Created October 10, 2012 15:41
shadow bars
<!doctype html>
<title>background bars proto</title>
<style type="text/css">
.row {
margin: .20em auto;
width: 200px;
position: relative;
font: 14px/22px sans-serif;
color: #333;
background: white;
@hdragomir
hdragomir / .vimrc
Last active October 12, 2015 08:47
By popular demand
autocmd!
set nocompatible
let mapleader = ","
filetype on
set title
set ai
set relativenumber
set cursorline
set expandtab expandtab
<script>
function abs(x) {
x = typeof x === "string" ? x.indexOf(',') > -1 ? Number.NaN : ( x.indexOf('.') > -1 ? parseFloat(x, 10) : parseInt(x, 10) ) : (typeof x === "number" || x === null ? x : Number.NaN);
return Number.isNaN(x) ? x : (x === null ? 0 : (x < 0 ? -x : x ));
}
function assert(message, condition) {
condition || console.error(message);
}
@hdragomir
hdragomir / droidshot.sh
Last active August 29, 2015 14:00
droidshot - simple cli utility that wraps taking screenshots from an android phone
function droidshot {
saveto=~/droidshots
fname=$(date +"%Y%m%d%H%M").png
[[ ! -z $1 ]] && fname=$1
[[ -d $saveto ]] || mkdir $saveto
adb shell screencap -p /sdcard/$fname
adb pull /sdcard/$fname $saveto/$fname
adb shell rm /sdcard/$fname
echo "saved to $saveto/$fname"
}