Skip to content

Instantly share code, notes, and snippets.

@BenjaminRH
BenjaminRH / wpsum.css
Created January 3, 2012 02:52
CSS for Wikipedia Summary Greasemonkey userscript
/*----- POPUP -----*/
.wpsum-popup-box {
position: absolute !important;
overflow: visible !important;
margin: 0 !important;
top: 20% !important;
left: 50% !important;
margin-left: -150px !important;
visibility: visible !important;
padding: 10px 25px !important;
@BenjaminRH
BenjaminRH / jonathancoulton.sh
Created January 25, 2012 13:44 — forked from robolson/jonathancoulton.sh
Bash script to download all of Jonathan Coulton's free songs.
#!/bin/sh
# Downloads all of Jonathan Coulton's free songs
# from http://www.jonathancoulton.com/store/downloads/
curl -C - "http://songs.jonathancoulton.com/free/mp3/Washy%20Ad%20Jeffy.mp3" -o "Washy Ad Jeffy.mp3" \
"http://songs.jonathancoulton.com/free/mp3/SkyMall.mp3" -o "SkyMall.mp3" \
"http://songs.jonathancoulton.com/free/mp3/Creepy%20Doll.mp3" -o "Creepy Doll.mp3" \
"http://songs.jonathancoulton.com/free/mp3/Big%20Bad%20World%20One.mp3" -o "Big Bad World One.mp3" \
"http://songs.jonathancoulton.com/free/mp3/Mr.%20Fancy%20Pants.mp3" -o "Mr. Fancy Pants.mp3" \
"http://songs.jonathancoulton.com/free/mp3/I'm%20Your%20Moon.mp3" -o "I'm Your Moon.mp3" \
// in routes.js
function redirectWhenLoggedIn(context) {
var user = Meteor.user();
if (user && !Meteor.loggingIn()) {
context.redirect('/dashboard');
}
}
var setSettings = function () {
Session.set('dashboard', false);
}
var setDashboard = function () {
Session.set('dashboard', true);
}
Meteor.pages({
'/settings': { to: "settings", before: [setSettings] },
function requireLogin() {
if (! Meteor.user())
this.redirect('/login');
}
Meteor.pages({
'/protected_page': { to: "protected_page", before: [requireLogin] },
});
<head>
<title>Cinder</title>
</head>
<body>
{{#isolate}}
{{renderPage}}
{{/isolate}}
{{!>logs_bootstrap}}
</body>
// On the client AND the server
Rooms = new Meteor.Collection('rooms');
Messages = new Meteor.Collection('messages');
// On the server
Meteor.publish('chatRoom', function(roomId) {
return Messages.find({ roomId: roomId });
});
// On the client
@BenjaminRH
BenjaminRH / gist:5638808
Last active December 17, 2015 16:29
Demonstrating switching views with Meteor when a user has logged in.
{{#if currentUser}}
{{> secretTemplate }}
{{else}}
{{> publicTemplate }}
{{/if}}
// Client
Meteor.subscribe('todos');
Template.timelinePublic.helpers({
timelineItems: function() {
return timelineItems.find({ timeline: Session.get("currentTimeline") });
}
});