Skip to content

Instantly share code, notes, and snippets.

View mplatts's full-sized avatar

Matt Platts mplatts

View GitHub Profile
@mplatts
mplatts / teams.coffee
Last active August 29, 2015 14:09
collections 1
# lib/collections/teams.coffee
@Teams = new Mongo.Collection('teams')
.dropdown
.email
%i.sprites-common-student
{{ email }}
= hb 'if pending' do
%a.resend-invitation{href: "#"} {{t 'organization.teachers.index.resend_invitation'}}
%a.pull-right.show-modal{href: "#", data: {template: 'people/remove_invited_teacher_modal', title: "{{t 'organization.teachers.index.remove_teacher' name=email }}"}}
%i.sprites-common-close
= hb 'else'
@mplatts
mplatts / _table.scss
Created May 28, 2014 10:16
_table.scss
$table-border: darken($gray-lighter, 10%);
$table-bg: mix($gray-lighter, $white);
.table {
background-color: $table-bg;
border-collapse: separate;
tr > *:first-child {
border-left: solid 1px $table-border;
}
@mplatts
mplatts / 0_reuse_code.js
Created May 14, 2014 13:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
class App.Collections.Bundles extends Backbone.Collection
url: '...'
parse: (results) ->
_(results).each (result) -> result.topics_count = result.topic_ids.length
results
class App.Models.Assignment.AssignmentTopic extends Backbone.Model
loading: -> @get('loading') || false
questionsRemainingCount: -> @get('questions_count') - @get('questions_answered_count')
questionsRemaining: -> @get('status') == 'try_it_again' || @get('status') == 'in_progress'
className: -> (@get('status') || '').replace(/_/g, '-')
scores: ->
if !@get('scores') || @get('scores').length == 0
i = @get('questions_count')
_([0..i]).map(-> { success: false, className: '' })
@mplatts
mplatts / q-learn-coin-rules.json
Created August 27, 2013 13:22
Proposed ruleset for how many coins should be issued for certain events/scenarios in q-learn apps
{
"login": {
"firstForDay": {
"coins": 1000,
"message": "First login for the day!"
},
"firstEver": {
"coins": 10000,
"message": "First login"
}
@mplatts
mplatts / index.html
Created October 30, 2012 05:20
Backbone Layout Manager Simple Example
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://raw.github.com/documentcloud/underscore/master/underscore.js"></script>
<script src="https://raw.github.com/documentcloud/backbone/master/backbone.js"></script>
<script src="https://raw.github.com/tbranyen/backbone.layoutmanager/master/backbone.layoutmanager.js"></script>
</head>
<body>
<div id="app"></div>
@mplatts
mplatts / index.html
Created October 30, 2012 03:48
Backbone Child Views Solution
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://raw.github.com/documentcloud/underscore/master/underscore.js"></script>
<script src="https://raw.github.com/documentcloud/backbone/master/backbone.js"></script>
</head>
<body>
<div id="app"></div>
@mplatts
mplatts / backbone_testing.coffee
Last active June 20, 2019 13:36
Backbone Testing Cheatsheet
# Libraries used:
# jasmine
# jasmine-jquery
# jasmine-sinon
# sinon
##### Basics Overview #####
describe "APP_NAME.Views.VIEW_FOLDER.VIEW_NAME ", ->
beforeEach ->