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
%h1 All Users | |
- table_for User.all do | |
- column "Username" => :username | |
- column "Email" => ->(m) { mail_to m.email } | |
- column "Notes" => :notes |
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/ruby | |
# | |
# Needs work, feel free to contribute. | |
# Dependencies: ANSI color escapes, spits out vim commands. | |
# | |
# USAGE | |
# ./sassify.rb list | |
# ./sassify.rb [files...] | |
# | |
# list - Command which lists all loaded SASSY variables. |
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 RetroEncabulator < RockwellAutomation::Base | |
end | |
class TurboEncabulator < RetroEncabulator | |
has_one :reverse_duractance_wheel, inverse_of: :duractance_wheel | |
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
# === Table Schema | |
# | |
# id: integer | |
# title: string | |
# body: string | |
# author_id: integer | |
# | |
class Post < ActiveRecord::Base | |
include Sluggable | |
belongs_to :author |
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
module CollectionHelper | |
#... | |
# This does a shitload of magic. It handles sort, order, filter, page and search. | |
# | |
def self.filter_scope(scope, params = {}) | |
unpermitted_params = [] | |
params = params.with_indifferent_access | |
params[:sort] ||= 'id' |
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
module HasGuid | |
extend ActiveSupport::Concern | |
included do | |
before_validation :generate_guid | |
class_attribute :guid_column_name | |
class_attribute :guid_options | |
validate :validate_guid |
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
# As if Ruby didn't make dates any easier, this! | |
# (#method_missing is disgusting and I love it.) | |
# | |
# 25.december 2015 #=> Fri, 25 Dec 2015 | |
# | |
class Fixnum | |
def method_missing(month, year=nil) | |
Date::MONTHNAMES.each_with_index do |m, i| | |
return Date.new year, i, self if m && month.to_s.casecmp(m)==0 | |
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
@App = React.createClass | |
#== Validations | |
propTypes: {} | |
contextTypes: {} | |
#== Initialize |
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 Items::Flour < Item | |
name "Flour" | |
description "Looks like crushed up wheat to you. Keep dry." | |
value 2.copper | |
stack_size 20 | |
# Use with a Bucket of Water to create Dough. Requires | |
# level 1 or greater cooking. | |
use_with Item::BucketOfWater, create: [Item::Dough, Item::Bucket], skills: { Skill::Cooking => 1 } |
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
@DateFormat = React.createClass | |
propTypes: | |
timestamp: React.PropTypes.number.isRequired | |
fuzzy: React.PropTypes.bool | |
dateOnly: React.PropTypes.bool | |
short: React.PropTypes.bool | |
className: React.PropTypes.string | |
getInitialState: -> | |
timer: null |
OlderNewer