Skip to content

Instantly share code, notes, and snippets.

View danlopez's full-sized avatar

Dan Lopez danlopez

  • SolarApp Foundation
  • Philadelphia, PA
View GitHub Profile
@danlopez
danlopez / count_test
Created March 24, 2014 18:59
Testing count with random number of models
it "returns correct number of submissions" do
meet = FactoryGirl.create(:meet, :user_group => group)
num = rand(10) #random number of submissions from 0 to 10
num.times do
FactoryGirl.create(:meet_submission, :meet => meet)
end
result = group.get_submission_count
expect(result).to eq(num)
end
{
"session": {
"user": {
"id": "52cace83374c10105e000005",
"email": "jason@apprennet.com",
"login": "jason",
"first_name": "Jason",
"last_name": "Blanchard",
"authentication_token": "HTjy9Qpm9XVvtjUJRTkH",
"organizations": [
@danlopez
danlopez / gist:11231390
Created April 23, 2014 20:34
submission#show
{"submission":
{
"id":"535558321baf6a00be000002",
"user_id":"52a6467e96ce892b96000055",
"meet_id":"51472390d8d36d7f83000001",
"video":{
"mp4":"http://test01.lawmeets.com.s3.amazonaws.com/1e/20ca80c97c11e39177399c8684c9d2/capturedvideo.mp4",
"webm":"http://test01.lawmeets.com.s3.amazonaws.com/1e/222a10c97c11e3a0ddd193f215c574/capturedvideo.webm",
"transloadit_assembly_id":"111ae5f0c97c11e3a10b39e170096e9b",
"transloadit_assembly_url":"http://api2.jaying.transloadit.com/assemblies/111ae5f0c97c11e3a10b39e170096e9b",
@danlopez
danlopez / gist:11231511
Created April 23, 2014 20:37
attachments#index
{
"attachments":
[{
"id":"53474e16c208e64b0c000002",
"file_name":"nurse leader manager.pdf",
"file_remote_url":"https://s3.amazonaws.com/assets02.apprennet.com/2014/04/10/22/06/15/711/nurse_leader_manager.pdf"
}]
}
@danlopez
danlopez / gist:11231625
Created April 23, 2014 20:40
attachment#create
{
"attachment"=>{
"id"=>"535824f81baf6a2c59000010",
"file_name"=>"test_file.txt",
"file_remote_url"=>nil
}
}
{
"meets":
[
{
"id": "5321a679374c100b81000019",
"created_at": "2014-01-07 19:54:28 +0000",
"name": "Assignment #1",
"description": "adf asdfasdfasdfasdf",
"summary": "ad asdf asdf asdf asdf asdf ......",
"status_description": "Submit Now",
@danlopez
danlopez / gist:bbe4453115564e319853
Last active August 29, 2015 14:02
Sample TinCan Statement (Dan completed ApprenNet Exercise ID asdf1234, took a bit over an hour...)
{
"actor": {
"name": "Dan",
"mbox": "dan@example.com"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/completed",
"display": {"en-US": "completed"}
},
"object": {
#contexts => ["mini_meet_submissions#rate:vote"]
#action => [:contexts => "mini_meet_submissions#rate"]
def self.does_context_match?(contexts, action)
if contexts == nil
return true
end
contexts.push("*").each do |c|
if(c.start_with? *action[:contexts])
return true
case $1 in
deploy)
docker run -it --rm -e "AWS_ACCESS_KEY_ID=$(printenv AWS_ACCESS_KEY_ID)" -e "AWS_SECRET_ACCESS_KEY=$(printenv AWS_SECRET_ACCESS_KEY)" -v ~/.ssh:/host-ssh apprennet/orchestrate /bin/bash -c \
"cp /host-ssh/* /root/.ssh/ && chmod 400 /root/.ssh/* && ruby tasks/trigger_deploy_pull.rb $2"
;;
status)
docker run -it --rm -e "AWS_ACCESS_KEY_ID=$(printenv AWS_ACCESS_KEY_ID)" -e "AWS_SECRET_ACCESS_KEY=$(printenv AWS_SECRET_ACCESS_KEY)" -v ~/.ssh:/host-ssh apprennet/orchestrate /bin/bash -c \
"watch -n 3 ruby tasks/container_status.rb $2"
;;
shell)
@danlopez
danlopez / gist:9a5d9e7ffe0064f667f2
Created January 19, 2015 17:20
Get Organizations
{
"organizations": [
{
"id": "5305f2e3105e12be5900003d",
"name": "Jason Blanchard",
"description": null,
"paid_status": true
},
{
"id": "5305f3cd105e12be59000061",