Skip to content

Instantly share code, notes, and snippets.

Steve Sloan CodeMonkeySteve

Block or report user

Report or block CodeMonkeySteve

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View xliff_trans
#!/usr/bin/env ruby
require 'bing_translator'
require 'active_support'
require 'active_support/core_ext'
class BingTranslator
@@cache = {}
@@cache_path = __dir__+'/.xliff_trans_cache'
@@cache = YAML.load_file(@@cache_path) if File.exist?(@@cache_path)
View spec-support-webmock.rb
require 'pathname'
require 'webmock/rspec'
module WebMock
# pass-through these domains (e.g. "www.facebook.com")
Allow = %w().freeze
end
RSpec.configure do |config|
stubs = {}
View ruby_style_guide.textile

Ruby/Rails Style Guide

Whitespace

  • Use 2-space indentation (no tabs).
  • Remove trailing whitespace.
  • Use Unix-style line endings.
  • Use spaces around operators, after commas, colons and semicolons, around { and before }.
  • Use two spaces before statement modifiers (e.g. postfix if, unless, while, until, or rescue).
  • Use empty lines to break up a long method into logical paragraphs.
  • Keep lines to fewer than 132 characters.
View possessive.rb
class String
def possessive
str = self + "'"
str += 's' unless %r{(s|se|z|ze|ce|x|xe)$}i.match(self)
str
end
end
@CodeMonkeySteve
CodeMonkeySteve / mongodb
Created Jan 7, 2010
initscript for mongodb
View mongodb
#! /bin/sh
# start / stop script for mongodb
#
# mongodb - this script starts and stops the mongo daemon
#
# chkconfig: - 85 15
# description: Mongodb
# processname: mongod
# config: /etc/sysconfig/mongodb
# pidfile: /var/run/mongod.pid
View progress_meter.rb
#!/usr/bin/ruby
class ProgressMeter
attr_accessor :progress, :total
def initialize( total = 1 )
@progress, @total = 0, total
@old_str_size = 0
end
You can’t perform that action at this time.