An incomplete cheatsheet for rails 3. Things are added as they are required.
# http://guides.rubyonrails.org/active_record_validations_callbacks.html
class SomeClass < ActiveRecord::Base
# length| Application.put_env(:sample, Example.Endpoint, | |
| http: [ip: {127, 0, 0, 1}, port: 5001], | |
| server: true, | |
| live_view: [signing_salt: "aaaaaaaa"], | |
| secret_key_base: String.duplicate("a", 64) | |
| ) | |
| Mix.install([ | |
| {:plug_cowboy, "~> 2.5"}, | |
| {:jason, "~> 1.0"}, |
| defmodule Crux.Http do | |
| use HTTPoison.Base | |
| def process_url(url) do | |
| Application.get_env(:crux, :api) <> url | |
| end | |
| def process_request_body(body) when is_map(body) do | |
| Poison.encode!(body) | |
| end |
| defmodule Inventory.Enum do | |
| @moduledoc """ | |
| Provides macro to support Enum datatype with Ecto | |
| ## Usage | |
| In your model: | |
| import Inventory.Enum |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| <?php get_header(); ?> | |
| <?php get_template_part( 'includes/contents/content', 'stream'); ?> | |
| <?php get_template_part( 'includes/contents/content', 'index' ); ?> | |
| <?php get_footer(); ?> |
| <?php | |
| /** | |
| * Posts & Pages meta boxes | |
| */ | |
| /** | |
| * Main custom meta boxes class | |
| */ | |
| if(!class_exists('AQ_Meta_Boxes')) { |
| <?php | |
| /* | |
| Template Name: Portfolio | |
| */ | |
| $column = strtolower($data['aq_portfolio_layout']); //Get number of columns | |
| get_header(); ?> | |
| <div id="content-full-width" class="cf"> |
| /** line 125 */ | |
| background: <?php echo $data['header_bg_color'] ?> url(<?php echo $data['header_bg_img'] ?>); | |
| // Change to: | |
| background: <?php echo $data['header_bg_color'] ?>; | |
| /** line 169 */ |
| if(is_multisite()) { | |
| $uploads = wp_upload_dir(); | |
| wp_register_style('options', $uploads['baseurl'] . '/options.css', 'style'); | |
| } else { | |
| wp_register_style('options', get_template_directory_uri() . '/css/options.css', 'style'); | |
| } |