Skip to content

Instantly share code, notes, and snippets.

@framallo
framallo / scoring_help.rb
Created June 6, 2014 19:19
scoring_peredictions
Write a method that accepts two arguments: an Array of five guesses for
finalists in a race and an Array of the five actual finalists. Each
position in the lists matches a finishing position in the race, so first
place corresponds to index 0. Return an Integer score of the predictions:
0 or more points. Correctly guessing first place is worth 15 points,
second is worth 10, and so on down with 5, 3, and 1 point for fifth
place. It's also worth 1 point to correctly guess a racer that finishes
in the top five but to have that racer in the wrong position.
class Image
attr_accessor :array
def initialize(array)
@array = array
@new_array = @array.map {|e| Array.new(e.size) }
end
def blur
@array.each_with_index do |row,x|
@framallo
framallo / linked_list_mutation.rb
Created September 4, 2015 16:37 — forked from vincentchin/linked_list_mutation.rb
Reverse a linked list using mutation
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node = nil)
@value = value
@next_node = next_node
end
end
def print_values(list_node)
require 'orderedhash'
#
# This class represents the INI file and can be used to parse, modify,
# and write INI files.
#
class IniFile
# Inifile is enumerable.
include Enumerable
@framallo
framallo / dfs.rb
Created September 17, 2015 19:16 — forked from vincentchin/dfs.rb
# In the above example it will check to see if the payload is 11 in the following order: 2, 7, 6, 5 when
# it gets to 5 and 5 has no children, it will return to the 6 and go to any children 6 has. 6 has a
# remaining child, which is 11 so that node is checked and since that value is the correct value it
# will be returned and searching will stop.
class Tree
attr_accessor :payload, :children
def initialize(payload, children)
@payload = payload
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link rel="stylesheet" type="text/css" media="all"
href="css/docs.css" />
<title>me</title>
allDocuments = function(db) {
console.log("Show All Docs"+ db.getLength());
db.view({
map : function(doc, emit){ console.log(doc) },
finished : function(view){ }
});
}
db2 = BrowserCouch('pages');
db2.sync('http://admin:admin@localhost:5984/pages',
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..39cbcef
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "frameworks/couchdb"]
+ path = frameworks/couchdb
+ url = git://github.com/devinus/sproutcore-couchdb.git
diff --git a/Buildfile b/Buildfile
$ git clone git@tangosource.com:workit.git
Cloning into workit...
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
remote: Counting objects: 1380, done.
remote: Compressing objects: 100% (980/980), done.
remote: Total 1380 (delta 554), reused 828 (delta 270)
Receiving objects: 100% (1380/1380), 2.68 MiB | 330 KiB/s, done.
Resolving deltas: 100% (554/554), done.
~
// ==========================================================================
// Project: Todozen.StoryDataSource
// Copyright: ©2011 My Company, Inc.
// ==========================================================================
/*globals Todozen */
/** @class
(Document Your Data Source Here)