git clone <repo>
clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS
Add colors to your ~/.gitconfig file:
| require 'dry-validation' | |
| SCHEMA = Dry::Validation.Schema do | |
| configure do | |
| config.input_processor = :sanitizer | |
| def self.messages | |
| Dry::Validation::Messages.default.merge(en: { errors: { unique?: "oops not unique" }}) | |
| end |
| require 'transproc/all' | |
| require 'addressable/uri' | |
| ## | |
| # Convert string keys to symbols | |
| # | |
| transform = Transproc(:symbolize_keys) | |
| data = { | |
| 'name' => 'Mark Rickerby', |
| Sequel.migration do | |
| up do | |
| run 'CREATE EXTENSION "uuid-ossp"' | |
| create_table :products do | |
| column :id, :uuid, :default => Sequel.function(:uuid_generate_v4), :primary_key => true | |
| end | |
| end | |
| end |
| #!/bin/sh | |
| # | |
| ## This is called to back up the WAL files to the slave. | |
| ## This is on top of replication and is used as another | |
| ## method to secure data successfully transferring from one | |
| ## database server to another. | |
| ARCHIVE_DIR_ON_SLAVE="/var/lib/postgresql/walfiles" | |
| LOG=1 | |
| LOG_FILE="/tmp/postgres_wal_archiving.log" |
| # Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source. | |
| # Will include all hosts the playbook is run on. | |
| # Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html | |
| - name: "Build hosts file" | |
| lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present | |
| when: hostvars[item].ansible_default_ipv4.address is defined | |
| with_items: groups['all'] |
| #!/usr/bin/env ruby | |
| require 'active_record' | |
| ActiveRecord::Base.establish_connection( | |
| :adapter => 'sqlite3', | |
| :database => ':memory:' | |
| ) | |
| ActiveRecord::Schema.define do |
| # include from an initializer | |
| module HstoreAccessor | |
| def self.included(base) | |
| base.extend(ClassMethods) | |
| end | |
| module ClassMethods | |
| def hstore_accessor(hstore_attribute, *keys) | |
| Array(keys).flatten.each do |key| |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| #!/bin/sh | |
| # Locale | |
| echo "Changing locale" | |
| sudo apt-get -y install language-pack-pt | |
| clear | |
| # System update | |
| echo "Updating repositories" | |
| sudo apt-get -y update |