Skip to content

Instantly share code, notes, and snippets.

View richsilv's full-sized avatar

Richard Silverton richsilv

View GitHub Profile
@richsilv
richsilv / meteor-template-get.js
Created August 27, 2015 12:18
Template instance `get` method for searching Template heirarchy for a named property
Blaze.TemplateInstance.prototype.get = function(key) {
var checkForKey = function(view) {
if (view && view.template instanceof Blaze.Template) {
var template = view.templateInstance()
if (typeof template[key] !== 'undefined') return template[key]
}
if (view.parentView) return checkForKey(view.parentView)
}
return checkForKey(this.view)
}
@richsilv
richsilv / local-replica-set-with-oplog.md
Created February 3, 2016 16:47
Setting up a local MongoDB replica set with oplog for use with Meteor

From an appropriate location:

mkdir replica-set
mkdir -p replica-set/rs0-0 replica-set/rs0-1
mongod --port 27018 --dbpath replica-set/rs0-0 --replSet rs0 --smallfiles --oplogSize 128 &
mongod --port 27019 --dbpath replica-set/rs0-1 --replSet rs0 --smallfiles --oplogSize 128 &
mongo localhost:27018
@richsilv
richsilv / .hyper.js
Created September 21, 2017 09:22
richsilv .hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
@richsilv
richsilv / bsconfig.json
Last active February 21, 2018 13:12
Example bsconfig.json
{
"name": "reason-react-example",
"bsc-flags": ["-bs-no-version-header", "-bs-super-errors"],
"reason": {"react-jsx" : 2},
"bs-dependencies": [
"reason-react",
"bs-fetch",
"@glennsl/bs-json"
],
"sources": [
@richsilv
richsilv / MDX-CSS-decorators.md
Last active January 24, 2023 18:44
MDX decorators to apply alternative styles when using Markdown primitives

MDX CSS Decorators

MDX is super-cool, allowing one to include React Components in a markdown file:

# Title

A nicely formatted paragraph of text with [some links](www.blahblah.com).
// Utility types (required only once):
interface Phantom<T> {
__phantom: T;
}
// The idea is that you narrow the type you're going
// to use with a property which you're definitely not
// going to use, but that distinguishes this from
// any old object which matches the same base interface.
export type NewType<T, TagT> = T & Phantom<TagT>;