Skip to content

Instantly share code, notes, and snippets.

View Altons's full-sized avatar

Alberto Negron Altons

View GitHub Profile

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

# Basic Twitter Analysis
# analyze and compare tweets for a defined set of hash and @ tags
# base code from "Data Science with R", a book for an introductory course from Syracuse, as per http://blog.revolutionanalytics.com/2013/02/free-e-book-on-data-science-with-r.html
# load the required packages:
require("bitops")
require("RCurl")
require("RJSONIO")
require("twitteR")
require("ROAuth")
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@Altons
Altons / .bash_profile
Last active August 29, 2015 14:27 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@Altons
Altons / homebrew.md
Created June 11, 2018 16:47 — forked from indiesquidge/homebrew.md
How to and Best of Homebrew

Homebrew

How To

Homebrew is a package management system for OS X. You can read more about it here, or simply run

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

to install it.

@Altons
Altons / install_ruby_rpi.sh
Created July 22, 2018 21:13 — forked from blacktm/install_ruby_rpi.sh
A Bash script to install Ruby 2.5 on the Raspberry Pi (Raspbian)
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Installs Ruby 2.5 using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh)
# --------------------------------------------------------------------------------------------
# Welcome message
@Altons
Altons / ActiveRecord Cheat Sheet v1
Created August 14, 2018 10:43 — forked from jessieay/ActiveRecord Cheat Sheet v1
Active Record cheat sheet with examples of queries I've needed most so far
ActiveRecord cheat sheet / EXAMPLES
INSTALL
=======
$ gem install activerecord
in GEMFILE: gem ‘activerecord’
REQUIRE
=======
require ‘active_record’
@Altons
Altons / index.md
Created August 14, 2018 10:44 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@Altons
Altons / spanish_postal_code_validator.rb
Created September 16, 2019 15:53 — forked from backpackerhh/spanish_postal_code_validator.rb
Spanish postal code validator for Rails
# Usage:
#
# class MyClass < ActiveRecord::Base
# ...
# validate :postal_code, spanish_postal_code: true # default message
# validate :postal_code, spanish_postal_code: { message: '<Your message>' } # custom message
# ...
# end
#
class SpanishPostalCodeValidator < ActiveModel::EachValidator