Skip to content

Instantly share code, notes, and snippets.

View cvd's full-sized avatar
😲

Colin Van Dyke cvd

😲
View GitHub Profile
@keys = Activity.where(curriculum_id: Curriculum.ignition).pluck(:assessment_key).compact
# @activities = Activity.where(activity_type: 'module', curriculum_id: Curriculum.ignition).inject({}) {|memo, a| memo[a.id] = a; memo }
@activities = Activity.where(curriculum_id: 3).inject({}) {|memo, a| memo[a.assessment_key] = a; memo }
def fix_page(page, e, b, school)
if page && page['data'] && page['data']['correct'] && page['data']['total']
grade = (page['data']['correct'] / page['data']['total'].to_f) * 100
act = @activities[page['id']]
unless e.activity_progresses.any? {|ap| ap.activity_id == act.id && ap.grade == grade }
passed = grade >= @activities[act.id].try(:passing_grade).to_i
e.activity_progresses.create(activity_id: act.id, grade: grade, passed: passed)
@keys = Activity.where(curriculum_id: 4).pluck(:assessment_key).compact
@activities = Activity.where(curriculum_id: 4).inject({}) {|memo, a| memo[a.assessment_key] = a; memo }
def fix_page(page, e, b, school)
if page && page['data'] && page['data']['correct'] && page['data']['total']
grade = (page['data']['correct'] / page['data']['total'].to_f) * 100
act = @activities[page['id']]
unless e.activity_progresses.select {|ap| ap.activity_id == act.id && ap.grade == grade }.any?
passed = grade >= act.try(:passing_grade).to_i
@rtomayko
rtomayko / gist:1202895
Created September 8, 2011 08:11
The Sazerac
You'll need:
- Old Fashioned glasses, two of
- Sugar cubes, two of
- Peychaud's Aromatic Cocktail Bitters, one bottle of
- Ice, enough to fill both glasses
- Water, one oz of
- Rye whisky, two oz of
- St. George Absinthe Verte, 0.333oz of
- Lemon, one twist of
task :cron => :environment do
DatabaseBackup.back_up_to_s3!
end
@jupiterjs
jupiterjs / JavaScriptMVC.md
Created May 24, 2011 16:58 — forked from moschel/JavaScriptMVC.md
JavaScriptMVC Overview

The following is a VERY rough draft of an article I am working on for Alex MacCaw's @maccman's Book. It is very rough, but even now a worthwhile read. Suggestions / comments are very welcome! Please help me :-)

Introduction

JavaScriptMVC (JMVC) is an open-source jQuery-based JavaScript framework. It is nearly a comprehensive (holistic) front-end development framework, packaging utilities for testing, dependency management, documentation, and a host of useful jQuery plugins.

Yet every part of JavaScriptMVC can be used without every other part, making the library lightweight. Its Class, Model, View, and Controller combined are only 7k minified and compressed, yet even they can be used independently. JavaScriptMVC's independence lets you start small and scale to meet the challenges of the most complex applications on the web.

This chapter covers only JavaScriptMVC's $.Class, $.Model, $.View, and $.Controller. The following describes each component:

@mattpodwysocki
mattpodwysocki / nodeconf_2011.md
Created May 7, 2011 02:03 — forked from guybrush/nodeconf_2011.md
a list of slides from nodeconf 2011
# Extend jQuery objects with Underscore collection methods.
#
# Each collection method comes in two flavors: one prefixed
# with _, which yields a bare DOM element, and one prefixed
# with $, which yields a jQuery-wrapped element.
#
# So if `this` is a jQuery object, instead of:
#
# _.max @, (el) -> $(el).height()
#
@dawsontoth
dawsontoth / RecordingVideo.js
Created February 17, 2011 19:43
How to record video, then share or save it. Using Appcelerator Titanium!
/**
* This sample lets you record and share video with Appcelerator Titanium on Android.
* REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK
* http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html
*/
/**
* First, create our UI. We'll have two buttons: record, and share.
*/
var win = Titanium.UI.createWindow({
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/