Skip to content

Instantly share code, notes, and snippets.

View tonatiuh's full-sized avatar

Tonatiuh Núñez tonatiuh

View GitHub Profile
// 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
tonatiuh / gist:f112656f31dae480cca49440d2b54689
Created July 1, 2016 23:44 — forked from marty-wang/gist:5a71e9d0a6a2c6d6263c
Compile and deploy React Native Android app of Release version to device.
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/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
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'
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

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
#!/usr/local/bin/bash

repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch
@tonatiuh
tonatiuh / git_bash_functions.md
Last active August 29, 2015 14:01
Bash functions that make automate some day to day tasks

Function that automates the creation of a new gitflow branch:

#!/bin/bash

function git_start_feature() {
  story_title=$1
  story_title=${story_title,,} # downcase string
  story_title=${story_title// /-} # replace spaces by dashes
 story_title=${story_title//\//-} # replace slashes by dashes

done

  • improve file copying
  • commit the files, created repo
  • install nginx

to do

  • install the gems

pending

  • install the gems for auth and main

Therubyracer + libv8 in Mavericks with ruby-1.9.3-p448 issue

Therubyracer

If therubyracer gives you a problem like this one when installing it:

ERROR:  Error installing therubyracer:
  ERROR: Failed to build gem native extension.

/Users/tonatiuh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb

Easy Nested Forms with Rails

Introduction

  • 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?