Skip to content

Instantly share code, notes, and snippets.

View mlynch's full-sized avatar
🍂
Building something new

Max Lynch mlynch

🍂
Building something new
View GitHub Profile
for(var i = 0; i < component.children.length; i++) {
var child = component.children[i];
//
}
for child in component.children
// do stuff
.embed {
#code {
.top {
position: relative;
height: 10px;
margin-top: 20px;
background-color: #eee;
border-top: 1px solid #ccc;
@include gradient-vertical(#eee, #ddd);
class DashboardRouter extends Backbone.Router
routes:
'': 'showPanel'
'dash/:panel': 'showPanel'
'dash/:panel/:subpanel': 'showPanel'
class DashboardView extends Backbone.View
initialize: ->
@router = new DashboardRouter
@router.on 'route:showPanel', @showPanel
showPanel: (panel, subPanel) =>
# Default the panel to 'projects' if it's empty
panel = panel or 'projects'
# Show the panel, toggle buttons, etc.
# ...
enablePushState = true
pushState = !!(enablePushState && window.history && window.history.pushState)
if pushState
Backbone.history.start
pushState: true
root: '/'
else
Backbone.history.start
$(document).on "click", "a[href^='/']", (event) ->
href = $(event.currentTarget).attr('href')
# Check if the link matches our route
passThrough = href.indexOf('/dash') != 0
# Allow shift+click for new tabs, etc.
if !passThrough && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey
event.preventDefault()
---
layout: default
title: Welcome
---
<div class="page-header">
<h1>Jetstrap Docs</h1>
</div>
Welcome!
@mlynch
mlynch / feedthefire.js
Created April 30, 2013 16:51
FeedTheFire Codiqa Demo
var ref = new Firebase("https://YOUR_FIREBASE_NAME.firebaseio.com/");
ref.child("meta").once("value", function(snapshot) {
$("#feed > :first").html(snapshot.val().description);
});
ref.child("articles").limit(10).on("child_added", function(snapshot) {
var article = snapshot.val();
var link = $("<a>", {"href": article.link, "target": "_blank"});
$("#feed").append($("<li>").append(link.html(article.title)));
$('#feed').listview('refresh');
});