I hereby claim:
- I am ivanyv on github.
- I am ivanyv (https://keybase.io/ivanyv) on keybase.
- I have a public key whose fingerprint is 66D2 81C2 EAFF 19BA 9B22 4404 D0BB 1424 7607 0208
To claim this, I am signing this object:
# Put this inside Rakefile | |
if ENV['VERSION'].present? && ENV['VERSION'].to_i.to_s != ENV['VERSION'] | |
pattern = '*' + ENV['VERSION'].split(//).map { |l| "#{l}*" }.join | |
migrations = Dir[File.join(Rails.root, 'db', 'migrate', pattern)] | |
if migrations.size == 0 | |
puts "No migrations matching `#{ENV['VERSION']}` found." | |
exit | |
else | |
migration = File.basename(migrations.first) | |
if migrations.size > 1 |
config.action_controller.page_cache_directory = Rails.root.join('public', 'cache-GET') |
require 'rubygems' | |
require 'chunky_png' | |
orig = ChunkyPNG::Image.from_file('input.png') | |
rows = (orig.width / 10.0).ceil | |
cols = (orig.height / 10.0).ceil | |
canvas = ChunkyPNG::Canvas.new(rows * 10, cols * 10).replace(orig) | |
(0...rows).each do |row| | |
x = row * 10 |
# app/models/my_model.rb | |
module MyApp | |
module Model | |
def self.included(base) | |
base.send :include, Mongoid::Document | |
base.send :include, Mongoid::Timestamps | |
base.send :include, ActiveAdmin::Mongoid::Patches | |
end | |
end |
# app/controllers/users_controller.rb | |
class UsersController < ApplicationController | |
respond_to :json, :xml | |
def show | |
@user = @user.find(params[:id]) | |
respond_with Serializer(@user) | |
end | |
end |
require 'singleton' | |
class G | |
include Singleton | |
attr_accessor :variables | |
def self.[](var) | |
variables[var] | |
end |
I hereby claim:
To claim this, I am signing this object:
Verifying that +ivan is my openname (Bitcoin username). https://onename.io/ivan |
<html> | |
<head> | |
<link rel="canonical" href="<%= current_uri_sans_amp %>"> | |
</head> | |
... | |
</html> |
# app/models/application_form.rb | |
module ApplicationForm | |
extend ActiveSupport::Concern | |
class_methods do | |
def model_name | |
# Project::Form.model_name => Project.model_name | |
name.deconstantize.constantize.model_name | |
end | |
end |