Skip to content

Instantly share code, notes, and snippets.

View calrrox's full-sized avatar
🏠
Remote office

Carlos Torrealba calrrox

🏠
Remote office
View GitHub Profile
@calrrox
calrrox / vs_config.json
Last active February 14, 2020 22:19
configuration for vs code
// Instalar extenciones:
// - endwise
// - Ruby
// - Ruby Solargraph
// - VSCode Ruby
// - https://github.com/ruby-debug/ruby-debug-ide
// - vscode-dbml
// - Live Share (microsoft account o github)
// - Gem lens
// - GitLens
@calrrox
calrrox / array.rb
Created August 12, 2018 20:48
sample extension, create sample! method
class Array
def sample!(n = nil)
raise TypeError.new('no implicit conversion of String into Integer') unless n.class == Integer
new_array = self.clone
random_sample = n.nil? ? sample : sample(n)
new_array -= random_sample.class == Array ? random_sample : [random_sample]
replace(new_array)
random_sample
end
end
@calrrox
calrrox / atom-rais-js-sutff.md
Last active May 31, 2017 11:52
RoR IDE with ATOM

Prerequisite:

  • Distro: Ubuntu 16.04

Install via ppa stable version:

  • open terminal window and paste the followig code:

    sudo add-apt-repository ppa:webupd8team/atom

  • then update system package index and install the package

@calrrox
calrrox / backup_restore.sh
Last active October 6, 2016 18:32 — forked from DTailor/backup_restore.sh
Backup/Restore PostgreSQL Database
# List all databases
sudo -u postgres psql --list
# Create backup file
sudo -u postgres pg_dump [database_name] > dumpl.sql
# Drop the database
sudo -u postgres dropdb [database_name]
# Create a new database
@calrrox
calrrox / webpack.config.js
Created July 3, 2016 21:54 — forked from learncodeacademy/webpack.config.js
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@calrrox
calrrox / postgresql-post-install.md
Created March 4, 2016 17:20
Postgresql configurations
  • Setup new user
    • sudo -u postgres createuser you_user_name -s
    • Set password
      sudo -u postgres psql
      postgres=# \password your_user_name
      
      
@calrrox
calrrox / git-post-install.md
Last active March 4, 2016 17:00
Git configurations

Configuración post install:

  • Set user name and email
      git config --global user.name "NAME LASTNAME"
      git config --global user.email email@example.com
    
    
  • Set editor and merge tool
@calrrox
calrrox / ubuntu-14.04-post-install.md
Last active March 16, 2016 15:01
Post install applications for set up a cool environment

First step

  • sudo apt-get install aptitude >> + g =(update)
  • sudo apt-get install ubuntu-restricted-extras

Internet

  • Chrome
     wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
    

sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'

@calrrox
calrrox / snippet atom bs3-form
Created February 8, 2016 15:45
snippet for atom
'.text.html':
'Form Bootstrap3':
'prefix': 'bs3-form'
'body': """
<form class="$1" action="$2" method="POST" role="form">
<legend>Form title</legend>
<div class="form-group">
<label for="$3">label</label>
<input type="text" class="form-control" id="$4" placeholder="Input field">
@calrrox
calrrox / git_bash_prompt.sh
Last active February 5, 2016 16:10
color prompt for git
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the return value of the previous command
#
# USAGE:
#