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
export PATH="/usr/local/bin/psql:$PATH" | |
export PATH="/Users/dobsonm2/mongodb/bin:$PATH" | |
export PATH="/Users/dobsonm2/scala/bin:$PATH" |
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
import requests | |
from bs4 import BeautifulSoup | |
import redis | |
#parse front page of hacker news | |
url = 'http://news.ycombinator.com/' | |
r = requests.get(url) | |
soup = BeautifulSoup(r.text) | |
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
import redis | |
import requests | |
from bs4 import BeautifulSoup | |
#create redis connection | |
redis_server = redis.Redis("localhost") | |
#read a link from the redis index | |
requrl = redis_server.lindex("index",2) |
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 ExampleSubject < ActiveRecord::Base | |
belongs_to :study | |
belongs_to :user | |
delegate :email, :to => :user | |
scope :retrieve_by_study_and_identifier, lambda{|study_id, subj_id| | |
where("study_id = ? and id = ?", study_id, subj_id)} | |
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
class ExampleSubject < ActiveRecord::Base | |
belongs_to :study | |
belongs_to :user | |
scope :retrieve_by_study_and_identifier, lambda{|study_id, subj_id| | |
where("study_id = ? and id = ?", study_id, subj_id)} | |
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
<% @subjects.each do |subject| %> | |
<tr> | |
<th><%= subject.id %></th> | |
<th><%= subject.identifier %></th> | |
<th><%= subject.email %></th> | |
<th><%= link_to "Edit Subject", edit_study_example_subject_path(@study,subject) %></th> | |
<th> | |
<%= form_for [@study, subject] , :html => {:method => :delete} do |f| %> | |
<%= f.submit "Delete", :class => "btn btn-info" %> | |
<% 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
<% @subjs.each do |subj| %> | |
<tr> | |
<th><%= subj.id %></th> | |
<th><%= subj.identifier %></th> | |
<th><%= subj.user.email %></th> | |
<th><%= link_to "Edit Subject", edit_study_example_subject_path(@study,subj) %></th> | |
<th> | |
<%= form_for [@study, subj] , :html => {:method => :delete} do |f| %> | |
<%= f.submit "Delete", :class => "btn btn-info" %> | |
<% 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
model.bind("change:datapoint", ()=> | |
$(@el).find(".datapoint").val(@model.model.get("datapoint"))) |
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 Doc | |
def initialize(doc) | |
doc.each do |key, value| | |
define_singleton_method key, lambda { value } | |
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
#!/usr/bin/env ruby | |
require 'json' | |
file = File.new(ARGV[0], "r") | |
#get format | |
puts "Getting format" | |
format = file.gets |
OlderNewer