I hereby claim:
- I am sj26 on github.
- I am sj26 (https://keybase.io/sj26) on keybase.
- I have a public key whose fingerprint is 2948 206E 98F5 A539 96F5 4211 1A36 ACA1 BDEC D23E
To claim this, I am signing this object:
require "eventmachine" | |
require "httparty" | |
class SmtpServer < EventMachine::Protocols::SmtpServer | |
# We override EM's mail from processing to allow multiple mail-from commands | |
# per [RFC 2821](http://tools.ietf.org/html/rfc2821#section-4.1.1.2) | |
def process_mail_from sender | |
if @state.include? :mail_from | |
@state -= [:mail_from, :rcpt, :data] | |
receive_reset |
diff -ur orig/ext/readline/readline.c fixed/ext/readline/readline.c | |
--- orig/ext/readline/readline.c 2014-03-18 13:53:31.866359527 +0100 | |
+++ fixed/ext/readline/readline.c 2014-03-18 13:56:26.390247250 +0100 | |
@@ -1883,7 +1883,7 @@ | |
rl_attempted_completion_function = readline_attempted_completion_function; | |
#if defined(HAVE_RL_PRE_INPUT_HOOK) | |
- rl_pre_input_hook = (Function *)readline_pre_input_hook; | |
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook; | |
#endif |
From 4c4da3fc650a3595ecc06f49072f1ffae07db706 Mon Sep 17 00:00:00 2001 | |
From: Thomas Dziedzic <gostrc@gmail.com> | |
Date: Sat, 1 Mar 2014 21:41:28 -0800 | |
Subject: [PATCH] Fix undeclared identifier error by using the actual type of | |
rl_pre_input_hook | |
--- | |
ext/readline/readline.c | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) |
App = | |
firstFunction: -> | |
doesSomething(or: other) | |
secondFunction: -> | |
somethingElse | |
usesClassesToo: -> | |
@behaviour = new App.RepeatedBehavoiur(or: other) | |
@anotherBehaviour = new App.RepeatedBehavoiur(and: another) |
I hereby claim:
To claim this, I am signing this object:
require "stringio" | |
require "cucumber/formatter/pretty" | |
# Instafail-style output which displays dots for success and writes | |
# verbose failure information in a single block so multi-process | |
# output interleaves nicely. | |
class Instacuke < Cucumber::Formatter::Pretty | |
def initialize(*) | |
super | |
@actualio = @io |
##################### Elasticsearch Configuration Example ##################### | |
# This file contains an overview of various configuration settings, | |
# targeted at operations staff. Application developers should | |
# consult the guide at <http://elasticsearch.org/guide>. | |
# | |
# The installation procedure is covered at | |
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>. | |
# | |
# Elasticsearch comes with reasonable defaults for most settings, |
@simpsora: any suggestions for a good way to parse multi-line messages in ruby? have command output which consists of blocks of 3 lines each, need to process each block together @sj26: maybe using scan and multiline regex?
$ ruby multiline.rb multiline.txt
["thing", "whatsit"]
["thang", "poppy"]
["thung", "scooby doo"]
["thong", "shaggy"]
require "strscan" | |
class LenientCSV | |
def initialize(source) | |
@scanner = StringScanner.new(source) | |
end | |
def each | |
until @scanner.eos? | |
yield scan_row |
# CREATE TABLE users (id INT NOT NULL AUTO_INCREMENT, age INT UNSIGNED, PRIMARY KEY id) | |
class User < ActiveRecord::Base | |
# column gives us age / age= | |
validates :age, presence: true, may_serve_alcohol: true | |
end | |
class MayServeAlcoholValidator < ActiveModel::EachValidator | |
def validate_each(model, attribute, value) | |
if model[attribute].present? && model[attribute] < 18 |