Skip to content

Instantly share code, notes, and snippets.

View maca's full-sized avatar

Macario Ortega maca

View GitHub Profile
@maca
maca / CSV.elm
Created April 29, 2017 01:45
Csv parsing
import Regex exposing (split, regex)
import List exposing (..)
import Html exposing (table, tr, td, th, text)
import Dict
input : String
input =
"name,age,gender\nmacario,36,male\nfabian,32,male"
@maca
maca / postgre_sql_database_tasks.rb
Created September 2, 2015 23:23
postgre_sql_database_tasks monkey patch to exclude schemas from dump.
module ActiveRecord
module Tasks # :nodoc:
class PostgreSQLDatabaseTasks # :nodoc:
def structure_dump(filename)
set_psql_env
puts "The monkeypatch located in #{__FILE__} should be removed when upgrading to Rails 5.0"
search_path = nil # Dump all schemas
unless search_path.blank?
@maca
maca / expected.json
Created December 12, 2014 17:13
expected.json
[
{
"name":"Ciencia",
"parent_id":null,
"id":7,
"children":[
{
"name":"Psicología",
"parent_id":7,
"id":12,
@maca
maca / output.json
Created December 12, 2014 17:11
output.json
[
{
"name":"Ciencia",
"parent_id":null,
"id":7,
"children":[
{
"name":"Psicología",
"parent_id":7,
"id":12,
#!/sbin/runscript
# GitLab Runner init script for Gentoo Linux
GITLAB_RUNNER_BASE=/home/runner/gitlab-runners/gitlab-ci-runner
GITLAB_RUNNER_USER=runner
depend() {
need net
}
@maca
maca / gitlab-ci
Last active April 8, 2018 02:15 — forked from nheine/gitlab-ci
#!/sbin/runscript
# GitLab-CI 4.3 init script for Gentoo Linux
GITLAB_BASE=/home/gitlab_ci/gitlab-ci
GITLAB_USER=gitlab_ci
depend() {
need net redis
}
@maca
maca / gitlab
Last active April 8, 2018 02:15
Gitlab nginx vhost
# GITLAB
# Maintainer: @randx
# App Version: 4.0
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen 443;
@maca
maca / account.rb
Last active September 21, 2019 04:31
spec/models/identity.rb
# app/models/account.rb
class Account < ActiveRecord::Base
devise :database_authenticatable, :registerable, :recoverable,
:rememberable, :trackable, :validatable, :confirmable, :validatable,
:omniauthable, omniauth_providers: [:facebook]
has_many :identities, dependent: :destroy
has_one :profile
# Traducciones adicionales en https://github.com/plataformatec/devise/wiki/I18n
es:
devise:
confirmations:
confirmed: "Tu cuenta ya ha sido confirmada."
confirmed_and_signed_in: "Tu cuenta ya ha sido confirmada. Has sido identificado."
send_instructions: "Recibirás un correo electrónico en unos minutos con instrucciones sobre cómo restablecer tu contraseña."
send_paranoid_instructions: "Si tu correo electrónico existe en nuestra base de datos recibirás un correo electrónico en unos minutos con instrucciones sobre cómo reiniciar tu contraseña."
failure:
development:
secret_key_base: 'hardoced-value-for-simplicity'
facebook_app_id: 'hardoced-value-for-simplicity'
facebook_app_secret: 'hardoced-value-for-simplicity'
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> # I want to raise an exception early if the ENV var is not set
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
facebook_app_secret: <%= ENV["FACEBOOK_APP_SECRET"] %>