Skip to content

Instantly share code, notes, and snippets.


Tonatiuh Núñez tonatiuh

View GitHub Profile

Since git allows you to run scripts as if they were git commands, this will show how to create a command for creating a pull request from the terminal.

  1. Create a file with the following name "git-pull-request", we can put it inside ~/.git/extensions for instance. Add the following content to the file

repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*[:/]\(.*\)\.git.*/\1/"`
branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
View atom_line_of_every_pane_highligted.less
// To keep highlighted the line of every pane in ~/.atom/styles.less (no matter if cursor leaves the pane)
atom-text-editor::shadow .lines .line.cursor-line {
background-color: rgba(255,255,134,0.3)
tonatiuh / gist:f112656f31dae480cca49440d2b54689
Created Jul 1, 2016 — forked from marty-wang/gist:5a71e9d0a6a2c6d6263c
Compile and deploy React Native Android app of Release version to device.
View gist:f112656f31dae480cca49440d2b54689
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/" -o "android/app/src/main/assets/"
set fish_greeting
# rvm > /dev/null
alias to='tmux attach -t'
alias gd='bundle exec guard'
alias gx='gitx'
alias v='nvim'
alias n='nvim'
alias bctags='ctags -R --exclude='.git' -f ./.git/tags --tag-relative=yes .'
alias cpb='git rev-parse --abbrev-ref HEAD | pbcopy'
View tmux.conf
unbind C-b
set -g prefix C-Space
bind Space send-prefix
set -g default-terminal "screen-256color"
# invoke reattach-to-user-namespace every time a new window/pane is opened
set-option -g default-command "reattach-to-user-namespace -l fish"
# Use vim keybindings in copy mode

Easy Nested Forms with Rails


  • What are nested forms?
    • Forms that allow you to save information not only for a base element, but for related elements of the main element

Basic Form

  • Someone is asking for a SalesOrder Form in which the client name can be set (as plain text)
  • What is required to accomplish that?


What we're going to show the client (Proposal):

  • App's use cases
  • Wireframes of the UI
  • Technical diagrams

What we're expecting to find:

tonatiuh /
Last active Jan 3, 2016
The material discussed along the Trainees classes (from Wednesday, January 15th to Friday 17th).
View after_update.rb
class EnglishStudentsController < ApplicationController
def update
@english_student = User.find(params[:id])
respond_to do |format|
if @english_student.update_attributes(english_student_params)
format.json { render json: { message: "Student updated successfuly" } }
format.json { render json: { message: "Student could not be updated" } }
tonatiuh / reset_db.sql
Created Jul 30, 2013
Reset db on psql
View reset_db.sql
'DROP TABLE '||c.relname ||' CASCADE;'
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_roles r ON r.oid = c.relowner
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','')
AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
AND pg_catalog.pg_table_is_visible(c.oid)