3D ball made with just some CSS 3D transforms, border-radius and border-style. Not really useful, it just looks nice...
This file contains hidden or 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
| git branch --merged | grep -v \* | xargs git branch -D |
This file contains hidden or 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
| has_many :items, inverse_of: :order, class_name: 'OrderItem', dependent: :destroy do | |
| def except(id) | |
| where(OrderItem.arel_table[:id].not_eq(id)) | |
| end | |
| end |
This file contains hidden or 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
| %s/:\([^ ]*\)\(\s*\)=>/\1:/g |
This file contains hidden or 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
| # This custom matcher can be used to test state machine | |
| # | |
| # Examples | |
| # | |
| # transition = OpenStruct.new(:name => :operation1, :state_field => :status, :from => :state1, :to => :state2) | |
| # it { should have_transition(transition) } | |
| # | |
| # transition = {:name => :operation2, :state_field => :status, :from => :state2, :to => :state3} | |
| # it { should have_transition(transition) } | |
| RSpec::Matchers.define :have_transition do |transition| |
This file contains hidden or 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
| # model | |
| after_validation :log_errors, :if => Proc.new {|m| m.errors} | |
| def log_errors | |
| Rails.logger.debug self.errors.full_messages.join("\n") | |
| end |
This file contains hidden or 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
| $ rails g model switchable_plan origin:references replacement:references 'switch_plan_fee:decimal{15,2}' | |
| # app/models/switchable_plan.rb | |
| class SwitchablePlan < ActiveRecord::Base | |
| belongs_to :origin | |
| belongs_to :replacement | |
| end | |
| # db/migrate/20131128082637_create_switchable_plans.rb | |
| class CreateSwitchablePlans < ActiveRecord::Migration |
This file contains hidden or 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' | |
| desc "Generates database.yml, optional arguments are allowed: [username, password, adapter, project_path]" | |
| task :dbconfig => 'database.yml' | |
| file 'database.yml', [:username, :password, :adapter, :project_path] do |t, args| | |
| Dir.chdir('config') | |
| args.with_defaults(:project_path => Dir.pwd) | |
| DBConfigGenerator.new(t, args).generate | |
| end |
This file contains hidden or 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
| defmodule Episode do | |
| defstruct id: nil, name: nil, video: nil, markdown: nil, post: nil | |
| def get_all do | |
| [ | |
| %Episode{id: "001", post: "271", name: "Introduction and Installing Elixir", video: "1366", markdown: "1382"}, | |
| %Episode{id: "002", post: "275", name: "Basic Elixir", video: "1367", markdown: "1357"}, | |
| %Episode{id: "003", post: "280", name: "Pattern Matching", video: "14879", markdown: "1413"}, | |
| %Episode{id: "004", post: "284", name: "Functions", video: "5086", markdown: "1559"}, | |
| %Episode{id: "005", post: "298", name: "Mix and Modules", video: "5087", markdown: "1654"}, |
This file contains hidden or 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
| - id: 71274 | |
| title: ALL MOONROCKS BOGO GRAM @ $25!!! | |
| body: BOGO GRAM @ $25 ON ALL MOONROCKS ALL DAY!!! | |
| coupon_type: daily | |
| discount_type: bogo | |
| discount_amount: | |
| distance: | |
| value: 7.330996145791065 | |
| units: mi | |
| url: "/deals#/709926" |
OlderNewer