Skip to content

Instantly share code, notes, and snippets.

View gstark's full-sized avatar

Gavin Stark gstark

View GitHub Profile
class Array
def sum
reduce(:+)
end
end
def is_laser(character)
character == '|' ? 1 : 0
end
#
# Cookbook Name:: apt
# Provider:: repository
#
# Copyright 2010-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
desc "Rebuild the development database and then seed "
task :rebuild_and_seed_development_database => %w{other_tasks} if Rails.env.development?
# versus
if Rails.env.development?
desc "Rebuild the development database and then seed "
task :rebuild_and_seed_development_database => %w{other_tasks}
end
# Assuming the exception is something like this
module Flicker
class ApiError < StandardError
end
end
def error_with_message(pattern)
error_handling_module = Module.new
(class << error_handling_module; self; end).instance_eval do
define_method(:===) do |exception|
$ rvm mount -r https://rvm.io/binaries/ubuntu/12.04/i386/ruby-1.9.3-p392.tar.bz2 --verify-downloads 1
https://rvm.io/binaries/ubuntu/12.04/i386/ruby-1.9.3-p392.tar.bz2 - #configure
ruby-1.9.3-p392 - #download
######################################################################## 100.0%
ruby-1.9.3-p392 - #validate archive
ruby-1.9.3-p392 - #extract
ruby-1.9.3-p392 - #validate binary
ruby-1.9.3-p392 - #setup
Saving wrappers to '/home/rdm/.rvm/wrappers/ruby-1.9.3-p392'........
ruby-1.9.3-p392 - #importing default gemsets, this may take time.......................
grep -i jgroup jboss.log
17:00:23,999 INFO [org.jboss.as.clustering.jgroups] (ServerService Thread Pool -- 56) JBAS010260: Activating JGroups subsystem.
17:00:26,119 WARN [org.jgroups.protocols.UDP] (ServerService Thread Pool -- 86) send buffer of socket java.net.DatagramSocket@5b5496bc was set to 640KB, but the OS only allocated 131.07KB. This might lead to performance problems. Please set your max send buffer in the OS correctly (e.g. net.core.wmem_max on Linux)
17:00:26,120 WARN [org.jgroups.protocols.UDP] (ServerService Thread Pool -- 86) receive buffer of socket java.net.DatagramSocket@5b5496bc was set to 20MB, but the OS only allocated 131.07KB. This might lead to performance problems. Please set your max receive buffer in the OS correctly (e.g. net.core.rmem_max on Linux)
17:00:26,120 WARN [org.jgroups.protocols.UDP] (ServerService Thread Pool -- 86) send buffer of socket java.net.MulticastSocket@24b5d935 was set to 640KB, but the OS only allocated 131.07KB. This might lead to performance problems.
@gstark
gstark / learning.md
Last active December 10, 2015 00:18
Resources for learning

For the numbers 1 through 1000

  • if the number is divisible by 5 print Iron

  • if the number is divisible by 7, print Yard

  • if it is divisible by both 5 and 7, print IronYard

  • that is:

1
@gstark
gstark / tesla_model_s_test_drive.md
Created July 29, 2012 16:21
Tesla Model S Test Drive

My review of the Tesla Model S test drive

Tesla Miami

July 28th, 2012

by Gavin Stark

DISCLAIMER: I am not a car guy. I don't know what a limited slip differential is (ok, I sorta know) and I don't drive a manual transmission

@gstark
gstark / lambda_and_threequals.rb
Created July 26, 2012 18:50
lambda_and_threequals.rb
>> matcher = lambda { |value| puts "value is #{value}"; value == "foo" }
=> #<Proc:0x0000000110219b28@(irb):14>
>> matcher === "foo"
=> false
>> matcher.call("foo")
value is foo
=> true
>>