Skip to content

Instantly share code, notes, and snippets.

View eduard-io's full-sized avatar
:octocat:

Eduard Giménez eduard-io

:octocat:
View GitHub Profile
@eduard-io
eduard-io / gist:2776761
Created May 23, 2012 18:11
Remove last element
h = {a: 1, b: 2, c:3}
# => {:a=>1, :b=>2, :c=>3}
a = h.flatten
# => [:a, 1, :b, 2, :c, 3]
a.reverse!
# => [3, :c, 2, :b, 1, :a]
a.shift(2)
# => [3, :c]
a
# => [2, :b, 1, :a]
# $OpenBSD: ssh_config,v 1.26 2010/01/11 01:39:46 dtucker Exp $
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
class UseUtf8mb4Characterset < ActiveRecord::Migration
def up
# The migration has been done following:
# - http://mathiasbynens.be/notes/mysql-utf8mb4#utf8-to-utf8mb4
# - http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-upgrading.html
database = Rails.configuration.database_configuration[Rails.env]["database"]
# Stop checking foreign keys
execute "SET foreign_key_checks = 0"
#!/usr/bin/env ruby
require File.expand_path('../config/environment', __FILE__)