Skip to content

Instantly share code, notes, and snippets.

@silentrob
silentrob / .block
Created November 10, 2016 05:05 — forked from nbremer/.block
Radar Chart Redesign
height: 600
+ show me your pic
- ^addMessageProp(icon_url, http://laorquesta.mx/wp-content/uploads/2014/12/bikers-300x225.jpg) Does this make you smile?
@silentrob
silentrob / bootstraper.js
Created January 24, 2015 23:37
Creating a boot file for a superscript bot
var facts = require("sfacts");
var fs = require("fs");
var worldData = [
'./data/concepts.top',
'./data/names.top',
'./data/oppisite.tbl',
'./data/worlddata/animals.tbl',
'./data/worlddata/color.tbl'
];
@silentrob
silentrob / weather.js
Created December 22, 2014 08:08
weather.js
var request = require("request");
exports.weather = function(cb) {
if (this.message.names) {
var location = this.message.names[0]
request.get("http://api.openweathermap.org/data/2.5/find?q="+location+"&type=like&units=metric&mode=json", function(err, res, body) {
var results = JSON.parse(body);
if (results.list.length != 0) {
cb(null, "It is " + results.list[0]['weather'][0]['description']);
} else {
cb(null, "I'm not near a window.");
@silentrob
silentrob / gist:528e1fcddfb5749817e3
Created December 11, 2014 23:55
telnet superscript example
// Run this and then telnet to localhost:2000 and chat with the bot
var net = require("net");
var superscript = require("superscript");
var debug = require('debug')("Server");
var options = {};
var facts = require("sfacts");
var factSystem = facts.explore("britfacts");
@silentrob
silentrob / gist:ad795eb955c9f6478814
Created December 11, 2014 23:44
Weather Plugin
var request = require("request");
debug = require("debug")("Weather Plugin");
exports.weather = function(city, cb) {
request.get("http://api.openweathermap.org/data/2.5/find?q="+city+"&type=like&mode=json", function(err, res, body) {
// debug("Weather Results", body);
var results = JSON.parse(body);
if (results.list.length != 0) {
cb(null, "It is " + results.list[0]['weather'][0]['description']);
} else {
@silentrob
silentrob / gist:3914f9544d118c64f138
Last active February 25, 2019 00:18
SuperScript Syntax
// Basic Syntax match, reply
+ when I see this
- reply with this
// Multiple replies, one choosen at random
+ when I see this
- reply with this
- or reply with this
// Alternates words in match
@silentrob
silentrob / plugins
Last active August 29, 2015 14:07
SuperScript Plugin Example
+ custom function
- ^runCode()
// When the input "custom function" is seen, we call the function runCode() from the plugin folder.
exports.runCode = function(cb) {
cb(err, reply);
}
// Data can also be passed into the function like this:
{ createdAt: Sat Sep 27 2014 00:06:54 GMT-0700 (PDT),
raw: 'What time did the train leave London ?',
clean: 'What time did the train leave London',
dict:
{ words:
[ [Object],
[Object],
[Object],
[Object],
[Object],
{ createdAt: Fri Sep 26 2014 23:46:15 GMT-0700 (PDT),
raw: 'My name is Bill .',
clean: 'My name is Bill',
dict: { words: [ [Object], [Object], [Object], [Object] ] },
words: [ 'My', 'name', 'is', 'Bill' ],
cwords: [ 'My', 'name', 'is', 'Bill' ],
taggedWords:
[ [ 'My', 'PRP$' ],
[ 'name', 'NN' ],
[ 'is', 'VBZ' ],