Skip to content

Instantly share code, notes, and snippets.

>>> Compiling ruby 2.1.2 ...
CC = gcc
LD = ld
LDSHARED = gcc -dynamic -bundle
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wextra-tokens -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
CPPFLAGS = -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/x86_64-darwin14.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -fstack-protector -Wl,-u,_objc_msgSend -Wl,-pie -framework Core
gem install mysql2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/bricker/.rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for ruby/thread.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
# LA Press Club blog parser
gem 'nokogiri'
require 'nokogiri'
require 'open-uri'
require 'time'
require 'fileutils'
def force_ascii(text)
require 'yaml'
module Mailbosa
class Settings
Path = [
'/home/renich/Projects/ruby/mailbosa/usr/local/etc/mailbosa/settings.yml',
'/home/renich/Projects/ruby/mailbosa/etc/mailbosa/settings.yml'
]
def initialize
if %w[ p h1 h2 h3 h4 h5 h6 h7 div span strong em ].include?(node.name) &&
(
node.children.empty? ||
( node.children.all? { |n| n.name == "text" } && node.content.strip.empty? )
)
node.remove
return
end
[5] pry(main)> node
=> #(Element:0x3fe96c8209fc {
name = "img",
attributes = [
#(Attr:0x3fe96d4b23f0 {
name = "class",
value = "alignleft size-large wp-image-4517"
}),
#(Attr:0x3fe96d4b23dc { name = "title", value = "AwardeesSoCal2014" }),
#(Attr:0x3fe96d4b23c8 {
class Person
def initialize(id, name, location)
@id = id
@name = name
@location = location
end
end
person = Person.new(id="0001", name="bricker", location="CA")
@bricker
bricker / s.rb
Last active August 29, 2015 14:03
RANGE_MIN = 360
RANGE_MAX = 1140
def fill_gaps(ranges)
gaps = []
last_rng_end = RANGE_MIN
ranges.each do |rng|
if rng[0] > last_rng_end
gaps << [last_rng_end, rng[0]]
describe SessionsController do
it "allows login with username" do
user = User.create(username: "bricker", password: "test", password_confirmation: "test")
post :create, username: "bricker", password: "test"
controller.session[:user_id].should eq user.id
end
# same for e-mail
end
class User
def initialize(firstName, lastName)
@firstName = firstName
@lastName = lastName
end
def firstName()
return @firstName
end