To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.
- Homebrew
- Mountain Lion
To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.
The app is organized into "modules" (not Ruby modules), like "Core", "Admin", "Directory", etc.
Each module contains models, controllers, and every other related class.
When I say "modules", I'm actually talking about domains, so why call them modules? I'm actually torn on this as I like how "modules" fits much better. But I also know
# 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 |
<html> | |
<head> | |
<link rel="canonical" href="<%= current_uri_sans_amp %>"> | |
</head> | |
... | |
</html> |
Verifying that +ivan is my openname (Bitcoin username). https://onename.io/ivan |
I hereby claim:
To claim this, I am signing this object:
require 'singleton' | |
class G | |
include Singleton | |
attr_accessor :variables | |
def self.[](var) | |
variables[var] | |
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 |
# 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 |
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 |