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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
get ("/movies") { | |
return Movie.all | |
} | |
get ("/movies/:id") { | |
movie = Movie.get(params["id"]) | |
return movie | |
} |
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
2014-09-30 21:01:01.432+0000 INFO [o.n.s.CommunityNeoServer]: Setting startup timeout to: 120000ms based on -1 | |
2014-09-30 21:01:01.507+0000 INFO [o.n.k.InternalAbstractGraphDatabase]: No locking implementation specified, defaulting to 'community' | |
2014-09-30 21:01:01.557+0000 INFO [o.n.k.i.DiagnosticsManager]: --- INITIALIZED diagnostics START --- | |
2014-09-30 21:01:01.558+0000 INFO [o.n.k.i.DiagnosticsManager]: Neo4j Kernel properties: | |
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.propertystore.db.mapped_memory=1285M | |
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.nodestore.db.mapped_memory=357M | |
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.relationshipstore.db.mapped_memory=1575M | |
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.propertystore.db.strings.mapped_memory=1092M | |
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: store_dir=/Users/karmenblake/Downloads/neo4j-community-2.1.5/data/ |
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
defmodule FizzBuzz do | |
def compute(n) do | |
s = case {rem(n, 3), rem(n, 5)} do | |
{0, 0} -> :FizzBuzz | |
{0, _} -> :Fizz | |
{_, 0} -> :Buzz | |
_ -> n | |
end | |
IO.puts(s) | |
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
IO.puts "Conway's Game of Life" | |
defmodule Cell do | |
def next_cycle do | |
receive do | |
{sender, number_live_neighbors} -> | |
cond do | |
number_live_neighbors < 2 -> | |
send sender, {:died, die_off} | |
number_live_neighbors > 3 -> |
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
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<script src="jquery-1.3.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
FireUnit Fun! | |
<input type="text" id="blah" name="blah" value="blah" /><br/> | |
<div id="some_div">some div</div> | |
</body> | |
</html> |
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
#Examples: | |
# modalbox_spawn(:link_text=>"content", :content=>"Content for light box", :width=>1000) | |
# modalbox_spawn(:link_text=>"partial render", :partial=>"partials/education_component", :locals=>{:key=>"value"}) | |
# modalbox_spawn(:link_image=>"icons/pedigree_button1.gif", :content=>"<h2>COMING SOON: Pedigree Viewer. w00t!</h2>") | |
# modalbox_spawn(:link_text=>"View Pedigree", :classes=>"black_link other1 other2", :content=>"<h2>COMING SOON: Pedigree Viewer. w00t!</h2>") | |
# modalbox_spawn(:link_text=>"View Pedigree", :id=> person_being_viewed, :content=>"some content") | |
def modalbox_spawn(options={}) | |
link_path = options[:link_path] || root_path | |
link_display = options[:link_text] || image_tag(options[:link_image]) |
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
########################################## | |
#Ruby idioms | |
######################################## | |
#old school | |
breakfast = nil | |
if !breakfast | |
breakfast = "bacon" | |
end | |
#cool but is there a better way? | |
breakfast = "bacon" unless breakfast |
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
#todo use select | |
def self.getDnaLab(lab_name) | |
DnaLabs.each do |lab| | |
if lab.name == lab_name | |
return lab | |
end | |
end | |
return nil | |
end | |
#todo: use select |
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 self.getDnaLab(lab_name) | |
DnaLabs.detect{|lab| lab.name == lab_name} | |
end | |
def self.getLabDisplayName(labName) | |
getDnaLab(labName).try(:display_name) || "" | |
end |
OlderNewer