Skip to content

Instantly share code, notes, and snippets.

View carlosipe's full-sized avatar
⛰️
🪂

Carlos I. Peña carlosipe

⛰️
🪂
View GitHub Profile
@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']
@carlosipe
carlosipe / vim-ruby-command-t-install.markdown
Created August 10, 2016 10:32 — forked from jwieringa/vim-ruby-command-t-install.markdown
Install Vim with Ruby Interpreter and Command-T on Ubuntu

Summary

The following instructions will install Vim with the Ruby interpreter and Command-T. I keep my vim settings under revision control, thus I have chosen to use Git's submodules and Pathogen to manage Command-T. Depending on your preferences, you may want to setup Command-T differently. I recommend reading through the Command-T Readme

Install dependencies (what my system required), hg, and rake

sudo apt-get install ruby ruby-dev libncurses5-dev mercurial clone build-essential rake

I chose to compile vim with my system Ruby, 1.8.7. It is important that you use the same version to compile both Vim and Command-T. If your using RVM and you want to do the same, before proceeding you will want to:

rvm use system
@carlosipe
carlosipe / fb.js
Last active August 29, 2015 14:21 — forked from ganglio/fb.js
var casper = require('casper').create({
verbose : true,
logLevel : 'info'
});
var images = [];
var fs=require("fs")
/**
* Configuration here
*/
var casper = require('casper').create({
viewportSize: {width: 950, height: 950}
});
casper.start('http://www.google.com/', function() {
this.captureSelector('/tmp/pp.png', 'body');
});
casper.run();
f you try to install any version of Windows from USB falsh drive you may got this error: “Setup was unable to create a new system partition or locate an existing system partition”
I have already found tricky solution for Windows 7 but it didn’t help me with Windows 8.1.
So I have found another solution that will be suitable for any Windows version.
Basically you just need to copy all installation files from USB flash drive to your HDD (or SDD) drive and make it bootable, and then continue installation from HDD to HDD
Step by step instruction:
@carlosipe
carlosipe / cache.rb
Last active August 29, 2015 14:08 — forked from alfanick/cache.rb
# Amadeusz Juskowiak <[email protected]> 2012 - MIT License
# 1. Put inside helpers do .. end
# 2. Set CACHE_DIR to somewhere writable and private (like CACHE_DIR=File.dirname(__FILE__) + '/tmp'
# 3. Use it! You can use fragment_expire to remove cache with given name.
#
# Example:
# %h1 foo
# = cache_fragment(:report, 300) do
# - data = get_data_slowly
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')