Skip to content

Instantly share code, notes, and snippets.

View carlosipe's full-sized avatar
⛰️
🪂

Carlos I. Peña carlosipe

⛰️
🪂
View GitHub Profile
get used to run always psql with the `E` option.
psql -E $DATABASE_URL
Whenever you run \ commands like \d table1 you see the queries psql is running.
It's really useful to learn about postgresql internals everyday.
eg:
\d schools
******** QUERY **********
SELECT pubname
export http_proxy=$HTTP_PROXY https_proxy=$HTTP_PROXY ftp_proxy=$HTTP_PROXY
wget http://ftpmirror.gnu.org/gcc/gcc-4.9.2/gcc-4.9.2.tar.gz
tar xf gcc-4.9.2.tar.gz
mkdir build-gcc
$ cd build-gcc
$ ../gcc-4.9.2/configure --program-suffix=-4.9.2 --enable-languages=c,c++ --disable-bootstrap --disable-shared
make -j4
make install
cd ..
@carlosipe
carlosipe / terminal-git-branch-name.md
Created November 17, 2018 09:34 — forked from jhas3c/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@carlosipe
carlosipe / router.ex
Created February 7, 2018 14:22 — forked from aportnov/router.ex
Elixir: Compiled EEx templates in Plug application
defmodule MyModule.Router do
@moduledoc """
Http Entry Point
"""
use Plug.Router
use Plug.ErrorHandler
plug Plug.Logger
plug :match
@carlosipe
carlosipe / my_app.ex
Created February 7, 2018 14:22 — forked from alanpeabody/my_app.ex
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@carlosipe
carlosipe / deploy.rb
Created January 30, 2018 14:31
mina script for Phoenix deployment
require 'mina/git'
set :domain, 'your_domain'
set :deploy_to, 'your_path_on_server'
set :repository, 'your_git'
set :branch, 'master'
set :app_name, 'your_app_name'
set :shared_paths, ['log']
" vim-plug: Vim plugin manager
" ============================
"
" Download plug.vim and put it in ~/.vim/autoload
"
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"
" Edit your .vimrc
"
" Basic stuff, leader to space, remap esc, saving files
:let mapleader = " "
:nnoremap <leader>ev :vsplit $MYVIMRC<cr>
:imap jk <Esc>l
:nnoremap <Leader>s :update<CR>
:nnoremap <Leader>x :x<CR>
:nnoremap <Leader>q :bd<CR>
:nnoremap <Leader><Leader> :FZF<CR>
:nnoremap <Leader>p :FZF<CR>
:nnoremap <Up> <nop>
env_hash = Hash[File.read("env.sh").scan(/(.*?)="?(.*)"?$/)]
ENV["POSTGRESQL_URL"] = env_hash.fetch('DB_TEST')
require_relative '../main'
module Settings
def self.testing?
true
end
end
def db_test(title, &block)
var all = document.getElementsByTagName("*");
for (var i=0, max=all.length; i < max; i++) {
(all[i]).contentEditable = "true";
}