This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{Infobox software | |
| name = ComfortableMexicanSofa | |
| developer = Oleg Khabarov | |
| released = {{release date|2010|10|13}} | |
| latest_release_version = <!-- If you update this, remember to also update [[List of content management systems]]--> 2.0.7<ref name="comfortable_mexican_sofa_release">https://rubygems.org/gems/comfortable_mexican_sofa/versions/2.0.7</ref> | |
| latest_release_date = {{release date|2017|12|24}} | |
| status = Active | |
| operating_system = [[Cross-platform]] | |
| platform = [[Ruby on Rails]] | |
| genre = [[Content management system]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
gem "bundler", "< 1.16" | |
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
en_hash = YAML::load_file(File.expand_path('../config/locales/en.yml', File.dirname(__FILE__))) | |
locales = %w(en de es fr nl pt-BR zh-CN zh-TW) | |
def fix_locale(locale_hash, en_hash) | |
result_hash = locale_hash | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Small script to join and clean-up ACA gpx files. | |
# Setup: | |
# - make sure you got nokogiri installed (gem install nokogiri) | |
# - throw this merger.rb in some directory | |
# - inside that directory create input/ folder | |
# - copy ACA .gpx files into that folder. Generally {direction}Main files plus Services files | |
# Usage: | |
# - from terminal run ./merger.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
brew update && brew upgrade postgresql | |
initdb /usr/local/var/postgres9.5.1 -E utf8 | |
pg_upgrade -d /usr/local/var/postgres -D /usr/local/var/postgres9.5.1 -b /usr/local/Cellar/postgresql/9.4.2/bin/ -B /usr/local/Cellar/postgresql/9.5.1/bin/ -v | |
rm -rf postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def bar | |
baz = 'something' | |
baz + what_with_context(:something) | |
end | |
end | |
module Wat | |
def what_with_context(id) | |
instance_exec(&Huh.some_method) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
# Accessing deep hash values. For example, given this hash: | |
# h = {:a => {:b => :c}} | |
# h.dig(:a, :b) | |
# => :c | |
# h.dig(:x, :y, :z) | |
# => nil | |
def dig(*path) | |
first, tail = path[0], path[1..-1] | |
node = self[first] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources :objects do | |
put :publish, :on => :member | |
end | |
before_filter :load_object | |
def update | |
@object.update_attributes!(params[:object]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative '../test_helper' | |
class ${1:Model}sControllerTest < ActionController::TestCase | |
def setup | |
@${1/./\l$0/} = ${1/./\l$0/}s(:default) | |
end | |
def test_get_index | |
get :index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ${1:Model}sController < ApplicationController | |
before_action :build_${1/./\l$0/}, only: [:new, :create] | |
before_action :load_${1/./\l$0/}, only: [:show, :edit, :update, :destroy] | |
def index | |
@${1/./\l$0/}s = ${1:Model}.page(params[:page]) | |
end | |
def show |
NewerOlder