This file contains hidden or 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
'scroll .approval-tweet-container': (event, template) -> | |
console.log event, event.currentTarget | |
$target = $(event.currentTarget) | |
from_top = $target.scrollTop() | |
from_bottom = (event.currentTarget.scrollHeight - from_top) - $target.outerHeight(true) | |
if from_top is 0 | |
template.$('.uppage').trigger('click') | |
$target.scrollTop(event.currentTarget.scrollHeight-$target.height()-6) | |
Deps.afterFlush -> |
This file contains hidden or 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
<div class="wall-full-screen-template other-class"> | |
<ul class="foo"> | |
<li class="bar">a</li> | |
<li class="bar">b</li> | |
<li class="bar">c</li> | |
<li class="bar">d</li> | |
<li class="bar baz">e</li> | |
</ul> | |
</div> |
This file contains hidden or 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
# Routes everything @ :organization_name* | |
class OrganizationsRouteController extends VueRouteController | |
loadingTemplate: "loading" | |
onBeforeAction: [ | |
-> | |
@loggedInOrBounce() | |
@checkOrganization() | |
] | |
checkOrganization: () -> | |
# NOTE: this keeps us from having to publish user_ids for |
This file contains hidden or 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
$modulus deploy | |
Welcome to Modulus | |
You are logged in as jhgaylor | |
undefined:1 | |
{ | |
^ | |
SyntaxError: Unexpected token | |
at Object.parse (native) | |
at Object.project.chooseProjectPrompt (/home/charming/.nvm/v0.10.28/lib/node_modules/modulus/lib/commands/project.js:692:21) |
This file contains hidden or 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
for foo in things | |
foo.asdf() |
This file contains hidden or 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
# assumes every element of both arrays has an id property unique | |
# within the array | |
preserveKeys = (preserve_from, preserve_into, keys=['_invalid']) -> | |
ids_to_update = {} | |
preserve_from.forEach (el) -> | |
keys.forEach (k) -> # for every key, try and preserve it | |
if el[k] # if the key exists on the object | |
ids_to_update[el.id] ?= {} # create the next level if it doesn't exist | |
ids_to_update[el.id][k] = el[k] # store the value as ids.id.key = value |
This file contains hidden or 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
function doAfterCallback (final_data) { | |
console.log(final_data); | |
} | |
function doAfter (data, callback) { | |
// 2nd http call depending on the results of the first | |
new_data = http.get(data); | |
callback(new_data); | |
} |
This file contains hidden or 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
# Relies on the existance of @obj, @field, and @objs | |
# @objs is used in the template to render the select options | |
# @obj is the object to save back to (It needs to have a save method!) | |
# @field is the field to store the select value on @obj | |
Template.smart_select.helpers | |
isSelected: (context) -> | |
field = context.field || "county_id" | |
_id = context.obj[field] | |
@_id is _id |
This file contains hidden or 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
Template.foo.helpers({ | |
attachMap:function () { | |
makeMap(); | |
} | |
}); | |
function makeMap() { | |
var container = document.getElementById("map"); | |
console.log("container", container); | |
This file contains hidden or 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
// Include some libraries | |
var Twit = require('twit'); | |
var _ = require('underscore'); | |
// Module pattern | |
// http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html | |
// This is a Immediately Invoked Function Expression (IIFE) | |
// tho i'll probably call it a self executing anonymous function | |
// It's used to create a new scope so that | |
// we don't muddy up the global namespace building our module |