Skip to content

Instantly share code, notes, and snippets.

View swallentin's full-sized avatar

Stephan Wallentin swallentin

View GitHub Profile
@swallentin
swallentin / traverse-jsonpath.js
Created July 10, 2013 15:34
A demo of how to traverse a document and fetch values from another document using JSONPath.
var traverse = require('traverse'),
jsonpath = require('JSONPath'),
_ = require('underscore');
var sourceDocument = {
monkey: "$.store.book[0].category",
another: {
monkey: "$.store.book[1].price"
}
@swallentin
swallentin / deferred.js
Created July 6, 2013 20:47
Using deferred and promises with Q.
var Q = require('q'),
fs = require('fs');
var readFile = function() {
var def = Q.defer();
fs.readFile('output.json', 'utf-8', function(error, text) {
@swallentin
swallentin / gist:5813883
Last active December 18, 2015 16:49
LiveReload script in JADE
script
document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')
@swallentin
swallentin / jquery-plugin-boilerplate.js
Last active December 10, 2015 12:28
jQuery plugin boilerplate
/*!
* jQuery lightweight plugin boilerplate
* Original author: @ajpiano
* Further changes, comments: @addyosmani
* Licensed under the MIT license
*/
// the semi-colon before the function invocation is a safety
// net against concatenated scripts and/or other plugins
// that are not closed properly.
@swallentin
swallentin / Admin Nav Bar - black.html
Created September 25, 2012 04:01
Bootstrap: Admin Nav Bar - black
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#" name="top">Brand Name</a>
<div class="nav-collapse collapse">
@swallentin
swallentin / Admin Nav Bar - white.html
Created September 25, 2012 04:01
Bootstrap: Admin Nav Bar - white
<div class="navbar">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#" name="top">Brand Name</a>
<div class="nav-collapse collapse">
@swallentin
swallentin / Blog posts with picture.html
Created September 25, 2012 04:00
Bootstrap: Blog posts with picture
<div class="row">
<div class="span8">
<div class="row">
<div class="span8">
<h4><strong><a href="#">Title of the post</a></strong></h4>
</div>
</div>
<div class="row">
<div class="span2">
<a href="#" class="thumbnail">
@swallentin
swallentin / Lesson plan example.html
Created September 25, 2012 04:00
Bootstrap: Lesson plan example
<div class="row">
<div class="span5">
<h4><a href="#">Lesson 1</a></h4>
<p>Overview of the course, prerequisites, instructor contact information, syllabus, location information</p>
</div>
<div class="span3">
Progress: <span class="pull-right strong">36%</span>
<div class="progress">
<div class="bar" style="width: 36%;"></div>
</div>
@swallentin
swallentin / Honors or badges.html
Created September 25, 2012 03:59
Bootstrap: Honors or badges
<div class="row">
<div class="span3">
<div class="page-header">
<p class="pull-right"><a href="#">see all</a></p>
<h4>Honors <small>(10)</small></h4>
</div>
<div>
<a href="#"><img src="http://placehold.it/60x60" class="img-circle"></a>
<a href="#"><img src="http://placehold.it/60x60" class="img-circle"></a>
<a href="#"><img src="http://placehold.it/60x60" class="img-circle"></a>
@swallentin
swallentin / Search-form-with-toggles.html
Created September 25, 2012 03:57
Bootstrap: Search form with toggles
<div class="row">
<div class="span2">
<div class="btn-group pull-right" data-toggle="buttons-radio">
<button class="btn active">All</button>
<button class="btn">Starred</button>
</div>
</div>
<div class="span4">
<form class="form-search">
<div class="input-append">