Skip to content

Instantly share code, notes, and snippets.

View patrickleet's full-sized avatar

Patrick Lee Scott patrickleet

View GitHub Profile
@patrickleet
patrickleet / router.js
Created November 14, 2013 18:13
route to same template
Router.map(function () {
this.route('home', {
path: '/',
template: 'myTemplate'
});
this.route('someroute', {
path: '/foo',
template: 'myTemplate'
@patrickleet
patrickleet / getParameterByName.js
Last active December 25, 2015 17:09
get query string param values by key name, optional url - uses location if none
function getParameterByName(name, url) {
var a = document.createElement('a');
a.href = url || location.href;
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(a.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
@patrickleet
patrickleet / gist:6312627
Created August 22, 2013 20:51
meteor.js cheatsheet
// Assuming the following directory structure
/*
app/
.meteor/
client/
server/
collections/
*/
// 1. Create a collection