Skip to content

Instantly share code, notes, and snippets.

View itelo's full-sized avatar
🎯
Focusing

itelo itelo

🎯
Focusing
View GitHub Profile
@itelo
itelo / jsbeautifyrc
Created February 13, 2016 18:23
js-beautify
{
// The plugin looks for a .jsbeautifyrc file in the same directory as the
// source file you're prettifying (or any directory above if it doesn't exist,
// or in your home folder if everything else fails) and uses those options
// along the default ones.
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"],
@itelo
itelo / bashrc
Created February 13, 2016 18:25
bashrc compres extract function
## COMPRESSION FUNCTION ##
compress() {
FILE=$1
shift
case $FILE in
*.tar.bz2) tar cjf $FILE $* ;;
*.tar.gz) tar czf $FILE $* ;;
*.tgz) tar czf $FILE $* ;;
*.zip) zip $FILE $* ;;
*.rar) rar $FILE $* ;;
@itelo
itelo / bashrc
Created February 13, 2016 18:26
PS1 with git branch
[[ $- != *i* ]] && return
function parse_git_branch {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="[@\u \W]\$\[\e[1;32m\]\$(parse_git_branch)\[\e[0m\]"
@itelo
itelo / bashrc
Created February 13, 2016 18:28
android usage
# Android usage
export PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/ixfh/Android/android-sdk-linux/platform-tools:/home/ixfh/Android/android-sdk-linux/tools
#export PATH:$PATH:/home/ixfh/Android/android-sdk-linux/platform-tools
#export PATH:$PATH:/home/ixfh/Android/android-sdk-linux/tools
export ANDROID_HOME='/home/ixfh/Android/android-sdk-linux'
@itelo
itelo / bashrc
Created February 13, 2016 18:28
alias to bashrc
alias activateP=". venv/bin/activate"
alias 2p="python2.7"
alias ll='ls -lh --color=auto --group-directories-first'
alias ls='ls --color=auto'
alias pacman="sudo pacman"
alias github="cd ~/Documentos/github/"
alias gitlab="cd ~/Documentos/gitlab/"
alias ..="cd .."
@itelo
itelo / .sublimeKeybinds
Created February 16, 2016 03:24
sublime keybinds
[
{ "keys": ["ctrl+shift+t"], "command": "delete_trailing_spaces" },
{ "keys": ["ctrl+shift+o"],"command": "prompt_open_folder" },
{ "keys": ["ctrl+g"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+g"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["f2"], "command": "toggle_menu" },
{ "keys": ["ctrl+shift+d"], "command": "find_under_expand_skip" },
]
@itelo
itelo / .bashrc
Last active February 23, 2016 19:56
github/gitlab func to cd
github() {
path=$1
count=0
shift
case $path in
*) pathToList=$(ls -d ~/Documentos/github/* | cut -f6 -d '/')
pathToDir=($(ls -d ~/Documentos/github/*))
for i in ${pathToList[*]};
do
echo $count')' $i
source /usr/share/nvm/init-nvm.sh
# With the basic (500 MB RAM) you will need a swap with 1 GB to run MEAN.js or
# Gitlab, you can do that following the steps above:
sudo swapon -s
sudo dd if=/dev/zero of=/swapfile bs=1024 count=2048k
sudo mkswap /swapfile
sudo swapon /swapfile
sudo echo '/swapfile none swap sw 0 0' > /etc/fstab
# This sets the system to swap memory only when RAM usage is more than 80%,
# default was swapping when RAM usage was more than 60%, which results in
# most of the services being swapped if you experience a traffic spike.
// flatten.js
const flatten = (array) => {
return array.reduce((acc, elm) => {
if (Array.isArray(elm)) {
acc.push(...flatten(elm))
} else {
acc.push(elm);
}
return acc;