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 'zlib' | |
class AnyMailer < ActionMailer::Base | |
def enqueue(method, *args) | |
message = self.send(method, *args) | |
Resque.enqueue(MailWorker, message: compressed_msg(message)) | |
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
require 'bundler' | |
require 'bundler/dsl' | |
require 'fileutils' | |
require 'tempfile' | |
namespace :gemfile do | |
task :fresh do | |
builder = Freshie.new | |
tempfile = Tempfile.new("#{builder.gemfile}.temp") |
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 |
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
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
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
# 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
# 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
#!/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
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? |