This file contains 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 Game | |
COLORS = ["R", "G", "B", "Y", "O", "P"] | |
def initialize | |
@comp = Computer.new | |
@player = Player.new | |
end | |
def play | |
10.times do |i| |
This file contains 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 Hangman | |
attr_accessor :words | |
def initialize | |
@words = [] | |
@word = [] | |
@hint = [] | |
@guess = "" | |
@player = Player.new() | |
@computer = Computer.new() |
This file contains 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
def swingers(couples) | |
randomized_couples = couples.shuffle | |
randomized_couples.each_with_index do |couple, index| | |
if index != randomized_couples.length - 1 | |
randomized_couples[index][1], randomized_couples[index+1][1] = randomized_couples[index+1][1], randomized_couples[index][1] | |
end | |
end | |
end |
This file contains 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 "http/client" | |
class Word | |
def initialize(word) | |
raise ArgumentError.new "Not a single word" if word.split(" ").size > 1 | |
@word = word | |
end | |
def wiki_title | |
wiki_page = WikipediaPage.new(@word) |
This file contains 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
# Edits to /etc/sysctl.conf | |
kern.sysv.shmall=65536 | |
kern.sysv.shmmax=16777216 |
This file contains 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
sudo sysctl -w kern.sysv.shmall=65536 | |
sudo sysctl -w kern.sysv.shmmax=16777216 |
This file contains 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
7/7/12 8:24:23.017 PM com.heroku.postgres-service: server starting | |
7/7/12 8:24:23.018 PM Postgres: 75469 /Applications/Postgres.app/Contents/MacOS/bin/pg_ctl: Status 0 | |
7/7/12 8:24:23.117 PM com.heroku.postgres-service: FATAL: could not create shared memory segment: Invalid argument | |
7/7/12 8:24:23.117 PM com.heroku.postgres-service: DETAIL: Failed system call was shmget(key=5432001, size=14499840, 03600). | |
7/7/12 8:24:23.117 PM com.heroku.postgres-service: HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 14499840 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections. | |
7/7/12 8:24:23.117 PM com.heroku.postgres-service: If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or |
This file contains 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
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> | |
<tr> | |
<td align="center" valign="top"><img src="http://i1102.photobucket.com/albums/g459/wa_tracy/tracybutton3150.jpg" width="150" height="150" alt="Liberating Working Moms Button" /></td> | |
<td align="center" valign="top"><textarea cols="25" rows="7"><a href="http://liberatingworkingmoms.com" target="_blank"><img height="150" width="150" src=" http://i1102.photobucket.com/albums/g459/wa_tracy/tracybutton3150.jpg " border="0" /></a></textarea></td> | |
</tr> | |
</table> |
This file contains 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
posts = Post.all | |
Parallel.each(posts, :in_processes => 10) do |post| | |
post.title = post.title.downcase | |
post.save! | |
end | |
# Goes with | |
# http://ruby.zigzo.com/2012/01/29/the-parallel-gem-and-postgresql-oh-and-rails/ |
This file contains 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
posts = Post.all | |
Parallel.each(posts, :in_processes => 10) do |post| | |
# Reconnect to prevent errors with Postgres | |
ActiveRecord::Base.connection.reconnect! | |
post.title = post.title.downcase | |
post.save! | |
end |