Skip to content

Instantly share code, notes, and snippets.

@leandrowd
leandrowd / .bashrc
Created May 31, 2012 14:26
.bashrc configs
function git_branch_name() {
git branch 2>/dev/null | grep -e '^*' | sed -E 's/^\* (.+)$/(\1) /'
}
function show_colored_git_branch_in_prompt() {
PS1="\[\033[01;32m\]\u@\h:\[\033[01;34m\]\w\[\033[31m\]\$(git_branch_name)\[\033[m\]$ "
}
#export ps1 to bash colors
show_colored_git_branch_in_prompt
@leandrowd
leandrowd / .bash_profile
Created May 31, 2012 14:31
.bash_profile configs
export GREP_OPTIONS="--color=auto"
export GREP_COLOR="4;33"
export CLICOLOR="auto"
source ~/git-completion.bash
alias gco='git co'
alias gci='git ci'
alias grb='git rb'
# Debugging Android Stock Browser using Weinre and Ngrok
This doc will show how to debug any mobile browser that doesn't have a good debug tool.
If your local website can be exposed to your device, you don't need install the Ngrok.
## Step-by-step
- Install the weinre app: `sudo npm -g install weinre`
//jQuery 1.8+
console.log($._data($("#element")[0]).events);
@leandrowd
leandrowd / group-render.js
Created July 5, 2014 08:57
Ember handlebars helper to avoid multiple metamorph tags inside an each block
import Ember from 'ember';
/**
* Ember handlebars group helper
*
* This helper will solve most of problems refering to metamorph
* tags inside a each block. You should use it when you don't need the two-way
* data binding inside your loop.
*
* Adapted from: https://github.com/emberjs/group-helper
@leandrowd
leandrowd / format
Created July 9, 2014 13:09
Format decimal numbers
function format(number){
var str = ""+ number,
arr = str.split('').reverse(),
formatted = [],
ret;
arr.unshift('-');
for(var x = 1, len = arr.length; x <= len; x++){
formatted.push(arr[x]);
@leandrowd
leandrowd / anagram.js
Last active July 27, 2017 01:34
Anagram checker
var fs = require('fs'),
filename = 'wordlist.txt',
anagramChecker;
function anagram(rawList){
return function (word){
var list = rawList.slice(),
matched = [];
while(wordFromList = list.shift()){
@leandrowd
leandrowd / .bash_aliases
Last active August 29, 2015 14:07
bash files
alias ..="cd .."
alias ..2="cd ../.."
alias ..3="cd ../../.."
alias ..4="cd ../../../.."
alias ..5="cd ../../../../.."
alias hothouse='cd ~/Documents/dev/hothouse'
alias serv-this='python -m SimpleHTTPServer 8000'
alias log-nice="git log --pretty=format:'%C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)'"
@leandrowd
leandrowd / dev-tools
Created October 2, 2014 05:26
Linux machine bootstrap
#Updating the repo
#Adding google chrome keys
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
#updating the apt-get with the new repos
sudo apt-get update
#build/compiling tools
@leandrowd
leandrowd / README.md
Last active August 29, 2015 14:14
Breakpoints css + javascript

Breakpoint detector

How to use

  • Add all snippets to your source (css, js);
  • Invoke the mixin inside your css @include breakpoints-for-javascript;;
  • Call the function breakpoint() and test the result against the strings (mobile|tablet|desktop|large);

i.e: breakpoint() === 'mobile'