Skip to content

Instantly share code, notes, and snippets.

configuration = configure do |config|
config.tail_logs = true
config.max_connections = 55
config.admin_password = 'secret'
config.app_server do |app_server_config|
app_server_config.port = 8808
app_server_config.admin_password = config.admin_password
end
end
#hello
def foo
end
def foo
end
# This is my gist
import org.apache.http.client._
import org.apache.http.client.methods._
import org.apache.http.impl.client._
import scala.xml._
object S {
def main(args : Array[String]) : Unit = {
val root = scala.xml.XML.load((new DefaultHttpClient).execute (
new HttpGet("http://whoismyrepresentative.com/getall_sens_bystate.php?state="+args.head)
).getEntity.getContent)
class MorseEncoder
TRANSLATIONS = {
:a => "._",
:b => "_...",
:c => "_._.",
:d => "_..",
:e => "."
}
def method_missing(m, *args)
# use .each (or each_with_index) and iteration to implement these
array_of_numbers = [1,2,3,4,5]
number_to_add = 2
puts array_of_numbers.add_a_number_to_each_of_these_numbers(number_to_add)
# => [3, 4, 5, 6, 7]
list = [:name, 'Chad', :place, 'Virginia']
list.turn_into_hash
#https://gist.github.com/786350
module Names
def self.included(klass)
klass.extend ClassLevelMethods
klass.send(:attr_reader, :displayed_attribute_info)
end
def to_s
"<#{self.class.name} " +
self.class.displayed_attribute_info.map do |attr_name, label|
module Names
# TODO
end
Object.send(:include, Names)
class Person
displayed_attribute :name
displayed_attribute :age
displayed_attribute :ssn, :label => "Social Security Number"