- 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
, orrescue
). - Use empty lines to break up a long method into logical paragraphs.
- Keep lines to fewer than 132 characters.
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
module IOTA | |
class Message | |
attr_reader :id, :nonce | |
def initialize(node, id: nil, payload: nil) | |
@node = node | |
@id = id || (metadata && metadata[:messageId]) | |
@payload = payload | |
@nonce = nil | |
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
#!/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) |
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 'pathname' | |
require 'webmock/rspec' | |
module WebMock | |
# pass-through these domains (e.g. "www.facebook.com") | |
Allow = %w().freeze | |
end | |
RSpec.configure do |config| | |
stubs = {} |
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
class String | |
def possessive | |
str = self + "'" | |
str += 's' unless %r{(s|se|z|ze|ce|x|xe)$}i.match(self) | |
str | |
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
#! /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 |
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
#!/usr/bin/ruby | |
class ProgressMeter | |
attr_accessor :progress, :total | |
def initialize( total = 1 ) | |
@progress, @total = 0, total | |
@old_str_size = 0 | |
end |