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
require 'spec_helper' | |
describe Product do | |
it{ should belong_to :designer } | |
it{ should have_many :taggings } | |
it{ should have_many(:tags).through(:taggings) } | |
it{ should have_many :images } | |
it{ should have_many :product_properties } | |
it{ should have_many(:available_properties).through(:product_properties) } |
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
def self.model_name | |
name = "Entry" | |
name.instance_eval do | |
def plural; pluralize; end | |
def singular; singularize; end | |
def i18n_key; singularize; end | |
def human(*args); singularize; end | |
end | |
return name | |
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
module EntryUtils | |
module StateMachine | |
extend ActiveSupport::Concern | |
included do | |
before_validation :ensure_default_state, :on => :create | |
state_machine :initial => :created do | |
before_transition any => [:published,:approved] do |entry, transition| | |
if entry.content_empty? |
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
#!/bin/bash | |
# | |
# Ruby 1.9.2 with options for database, and nginx install. Adds option to install RVM system-wide. | |
# Outputs to /root/stackscript.log | |
# | |
# <UDF name="deploy_user" Label="Name of deployment user." /> | |
# <UDF name="deploy_password" Label="Password for deployment user." /> | |
# <UDF name="deploy_sshkey" Label="Deployment user public ssh key." /> | |
# <UDF name="ssh_port" Label="SSH Port" /> | |
# <UDF name="new_hostname" Label="Server's hostname." /> |
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
# A sample Guardfile | |
# More info at https://github.com/guard/guard#readme | |
rspec_opts = { | |
cli: '--colour --format documentation --fail-fast', | |
version: 2, | |
all_after_pass: false, | |
all_on_start: false, | |
notify: true, | |
keep_failed: false |
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
# Re-find partitions | |
partprobe | |
# Possibly reboot here | |
# double check real quick drives are back, if not partprobe again | |
blkid | |
# Re-mount | |
mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1 |
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 AssetHandler < Sprockets::Environment | |
def initialize | |
Sprockets.register_engine '.scss', Tipsy::Sass::Template | |
super(Tipsy.root) do |env| | |
env.static_root = Tipsy.options.asset_path | |
end | |
Tipsy.sprockets = self | |
configure_paths! | |
configure_compass! |
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
require File.expand_path('../../../config/application', __FILE__) | |
require 'rack' | |
require 'sqlite3' | |
module Rack | |
class MbTiles | |
attr_reader :app | |
def initialize(app) |
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
(function(jQuery, undefined){ | |
// | |
// Check an element for support of a particular attribute | |
function supports_attribute( attr, element, type ){ | |
element = document.createElement( element ); | |
exists = ( attr in element ); | |
if( typeof type == 'undefined' || exists === false ){ return exists; } | |
return jQuery.type( element[attr] ) === type; | |
} |
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/env ruby | |
require 'optparse' | |
require 'ostruct' | |
require 'date' | |
class Vhost | |
VERSION = '0.0.1' | |
attr_reader :options |