Skip to content

Instantly share code, notes, and snippets.

View aalvarado's full-sized avatar
😎

Adan Alvarado aalvarado

😎
View GitHub Profile
@aalvarado
aalvarado / reabase-on-upstream
Created September 29, 2011 16:39
bashscript for rebasing on upstream master.
#!/bin/sh
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
current_branch=$(parse_git_branch)
if [[ -n "$current_branch" ]]; then
git fetch -v upstream
git checkout master
@aalvarado
aalvarado / .bashrc
Last active September 27, 2015 13:17
.bash_profile
# Probaby windows with msys (old times)
alias ls='ls -A --color=yes'
alias dir='ls -A --color=yes'
alias vi='vim'
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gfu='git fetch upstream master:upstream'
alias gf='git fetch origin master:remote-master'
alias gp='git push'
struct Person;
impl Person {
fn hello(&self) -> &'static str {
return "hello";
}
}
fn main() {
println!("Hello, world!");
let p = Person;
@aalvarado
aalvarado / pg_change_db_owner.sh
Created September 29, 2015 18:03 — forked from jirutka/pg_change_db_owner.sh
Some convenient scripts to manage ownerships and privileges in PostgreSQL.
#!/bin/bash
#
# The MIT License
#
# Copyright 2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@aalvarado
aalvarado / vim-regex.txt
Created March 28, 2013 04:51
Change Ruby hash syntax to 1.9
%s/\(:\)\(\S\+\)\s\+=>/\2:/
@aalvarado
aalvarado / ctags.txt
Created April 1, 2013 23:41
Exhuberant ctags with javascript filtering and appending to `tags` file.
ctags -aR --languages=-javascript app
before_filter :find_position, only: [:show, :destroy, :edit]
def destroy
if @position.destroy
flash[:success] = t('labels.success')
else
flash[:error] = t('labels.error')
end
redirect_to positions_path
end
{
"title": "Escape enhancements",
"rules": [
{
"description": "Escape toggles capslock if enabled",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "escape",
@aalvarado
aalvarado / .ctags
Created July 11, 2018 22:00
.ctags
--exclude=*.json
--exclude=*.lock
--exclude=*.yaml
--exclude=.bundle
--exclude=Gemfile
--exclude=Gemfile.lock
--exclude=*.git*
--exclude=*.pyc
@aalvarado
aalvarado / _Algorithms_
Last active August 22, 2018 16:48
Algorithms
1