Skip to content

Instantly share code, notes, and snippets.

View joselo's full-sized avatar

Jose Carrion joselo

View GitHub Profile
@joselo
joselo / test.rb
Created October 14, 2022 18:09
Get the parent div of a child div with a title
container = find(".box-header", text: "E-Billing Information").first(:xpath, ".//..")
within(container) do
end
@joselo
joselo / app.js
Created January 5, 2014 06:52
How to user a resolver to check if a user is signed in
'use strict';
angular.module('instafacApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute'
])
.config(function ($routeProvider, $httpProvider){
@joselo
joselo / database.yml
Created July 2, 2012 23:13
database.yml config file for postgresql
default: &local_defaults
adapter: postgresql
host: localhost
port: 5432
min_messages: warning
encoding: utf8
username: postgres
password:
template: template0
@joselo
joselo / docker
Last active December 2, 2017 03:17
Docker Useful Commands
# Remove unused images
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")
# Remove dangling images
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
# Ejecutar bash dentro de un servicio docker
$ docker-compose exec <service id> bash
# Backup database
docker exec -i APPNAME_db_1 pg_dump -U postgres -C APPNAME_production > /tmp/APPNAME_production.back
# Restore
docker exec -i APPNAME_db_1 psql -U postgres < APPNAME_production.back
# Rename database
docker exec -i APPNAME_db_1 psql -U postgres
ALTER DATABASE name RENAME TO new_name
@joselo
joselo / gist:08685facf0d651817cd30e7cfd163f38
Last active July 21, 2017 05:16
Useful Vim key bindings

Useful Vim key bindings

movement

  • 0 - beginning of line
  • ^ - beginning of non-whitespace
  • $ - end of line
  • 9j - move down 9 lines
  • w - move forward by word
  • b - move backward by word
@joselo
joselo / gist:02dbc19f6f82e1ce2d3d4411cb71d757
Created July 4, 2017 20:20
Base Rails API Vue Postgresql
rails new . --api --webpack=vue --database=postgresql
gem 'closure_tree', '~> 6.5'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'pundit', '~> 1.1'
gem 'rails-i18n', '~> 5.0', '>= 5.0.4'
gem 'rails_12factor', group: :production
gem 'exception_notification', git: 'https://github.com/smartinez87/exception_notification'
@joselo
joselo / gist:c23a8b56e3184e1209d37c67ada56b23
Last active June 17, 2017 04:27
Dispatch and listen event in polymer
// Dispatch
var event = {
bubbles: false,
composed: true,
detail: {
criteria: selectedCriterion
}
}
this.dispatchEvent(new CustomEvent('event', event));
@joselo
joselo / spacemacs-cheatsheet.txt
Created February 24, 2017 04:27 — forked from 526avijitgupta/spacemacs-cheatsheet.md
Spacemacs cheatsheet
`emacs --daemon` to run in the background.
`emacsclient.emacs24 <filename/dirname>` to open in terminal
NOTE: "M-m and SPC can be used interchangeably".
* Undo - `C-/`
* Redo - `C-?`
* Change case: 1. Camel Case : `M-c`
2. Upper Case : `M-u`
3. Lower Case : `M-l`
@joselo
joselo / gist:48adba37d42800339a99c17867821a6b
Created January 9, 2017 00:28
Install fonts and other stuffs for programming in my archlinux
yaourt -S ttf-roboto-mono-powerline-git