Skip to content

Instantly share code, notes, and snippets.

#!upstart
#
# An upstart script for running ghost as a service on digitalocean;
# using Forever as the process monitor. For more configuration options
# associated with Forever, see: https://github.com/nodejitsu/forever
#
# You will need to set the environment variables noted below to conform to
# your use case, and should change the description.
#
description "Example upstart script for a Node.js process"

Given the following three autorun functions:

function autoRun1 () {
  var orValue = Session.get("a") || Session.get("b")
  console.log("Autorun 1::First Value:: ", orValue);
}

function autoRun2 () {
 var andValue = Session.get("a") && Session.get("b")
@cemre
cemre / greatcirclearc.java
Created October 22, 2011 22:36
Rendering great circle arcs in Processing between two coordinates
void drawPath(float lat1, float lon1, float lat2, float lon2) {
stroke(0);
strokeWeight(5);
noFill();
lat1 *= PI/180;
lon1 *= PI/180;
lat2 *= PI/180;
lon2 *= PI/180;
@boh1996
boh1996 / bootstrap-recaptcha.css
Created October 1, 2012 14:31
Twitter Bootstrap reCAPTCHA
.input-recaptcha {
width:172px;
}
@cdesante
cdesante / legends2.r
Created November 11, 2012 23:46
legends2
toInstall <- c("ggplot2", "reshape")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
library(ggplot2)
library(reshape)
ANES <- read.csv("http://www.oberlin.edu/faculty/cdesante/assets/downloads/ANES.csv")
party.and.region <- ANES[,c(1, 12, 16)]
party.and.region.year <- melt(party.and.region, id=c("year", "south"), na.rm=TRUE)
party.region.time <- (cast(party.and.region.year, year+south~variable, mean, na.rm=T) )
@pamelafox
pamelafox / autoresizer.js
Created March 22, 2012 06:11
TextArea AutoResizer (Bootstrap jQuery/Zepto Plugin)
var AutoResizer = function (textArea, options) {
var self = this;
this.$textArea = $(textArea);
this.minHeight = this.$textArea.height();
this.options = $.extend({}, $.fn.autoResizer.defaults, options)
this.$shadowArea = $('<div></div>').css({
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
//
// See README for overview
//
'use strict';
//
@svasva
svasva / publish.js
Created February 22, 2013 10:07
Meteor publish-with-relations complex use
Meteor.publish('bike', function(id) {
return Meteor.publishWithRelations({
handle: this,
collection: Bikes,
filter: id,
mappings: [
{
key: 'userId',
options: { fields: config.users.publicFields },
collection: Meteor.users
#sankey of PIMCO All Asset All Authority holdings
#data source http://investments.pimco.com/ShareholderCommunications/External%20Documents/PIMCO%20Bond%20Stats.xls
require(rCharts)
#originally read the data from clipboard of Excel copy
#for those interested here is how to do it
#read.delim(file = "clipboard")
@mikowals
mikowals / publishJoin.html
Last active December 20, 2015 15:19
Meteor reactive publish with collection join answering Stack Overflow question ( http://stackoverflow.com/questions/17902480/how-do-i-make-a-collection-reactive-based-on-the-contents-of-another)
<head>
<title>publishTest</title>
</head>
<body>
{{> hello}}
</body>
<template name="hello">
<h1>Hello World!</h1>