Skip to content

Instantly share code, notes, and snippets.

@olawiberg
olawiberg / Anchors in Markdown to create Table of Contents
Last active January 22, 2018 16:32
A simple markdown reference to explain how table of contents can be created in Github flavored markdown using anchor links.
Anchors in github markdown are created automatically when a header is created, the anchor link is the
header text modified to an all-lower-case string with spaces replaced with dashes. For example:
To link to a section with header `## This is a great section` you would create an anchor link reference
like this `(#this-is-a-great-section)`.
To create the link itself you use the standard markdown format [link-name](link-ref). To create a
table of contents you can repeat that for all the section headers in your document like this:
* [Section One](#section-one)
# Generate a 256 key
head /dev/urandom | shasum -a 256
# List supported algorithms for OpenSSL
openssl list-message-digest-algorithms
App.MessagesRoute = Ember.Route.extend({
model: function() {
return App.Message.find();
},
setupController: function(controller) {
controller.set('user', App.User.find(getCurrentUserId()));
}
});
App.MessageRoute = Ember.Route.extend({
@olawiberg
olawiberg / gist:3977137
Created October 29, 2012 23:09
remove specialty
removeSpecialty: function(options) {
var userId = options.userId;
var toRemove = options.specialty || {};
var topic = Topics.findOne({name:toRemove.name});
var user = Meteor.users.findOne(userId)
if(!user)
throw new Meteor.Error("User not found")
if(!topic)
throw new Meteor.Error("Topic not found")
var current = _.map(user.profile.specialties, function(obj){return obj._id})
@olawiberg
olawiberg / sbtinit.sh
Created March 2, 2012 20:19
sbtinit script to create a simple project file structure with option to initialize git and/or eclipse-plugin
#! /usr/bin/env bash
#
# Create a folder structure for an sbt scala project with options
# to initialize git and eclipse plugin.
BUILD_SBT_FILE="./project/build.sbt"
GITIGNORE_FILE="./.gitignore"
APP_NAME=${PWD##*/}
DO_GIT=false
DO_ECLIPSE=false
PROJECT_PATH="."