Skip to content

Instantly share code, notes, and snippets.

View Altons's full-sized avatar

Alberto Negron Altons

View GitHub Profile
@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

GIT
remote: https://github.com/spree-contrib/spree_i18n.git
revision: 5021782dacb25c906b52925cec25494fbdd78dea
specs:
spree_i18n (3.3.2)
i18n_data
kaminari-i18n
rails-i18n
routing-filter
spree_core (>= 3.1.0, < 4.0)
@Altons
Altons / .editorconfig
Last active November 11, 2021 14:38
.editorconfig
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
trim_trailing_whitespace = true
charset = utf-8
@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
@Altons
Altons / migration.rb
Created November 23, 2019 09:03 — forked from apneadiving/migration.rb
incremental invoice numbers without gap in rails + postgresql
class CreateInvoiceNumbers < ActiveRecord::Migration
def up
create_table :invoice_numbers do |t|
t.integer :year, null: false, unique: true
t.integer :next_number_within_year, null: false, default: 1
end
add_index :invoice_numbers, :year, unique: true
(2016..2045).each do |year|
@Altons
Altons / calendarHeat.R
Created February 9, 2020 10:26 — forked from aaronwolen/calendarHeat.R
Calendar Heatmap by Paul Bleicher
##############################################################################
# Calendar Heatmap #
# by #
# Paul Bleicher #
# an R version of a graphic from: #
# http://stat-computing.org/dataexpo/2009/posters/wicklin-allison.pdf #
# requires lattice, chron, grid packages #
##############################################################################
## calendarHeat: An R function to display time-series data as a calendar heatmap