This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Repeat = {}; | |
Repeat.__noSuchMethod__ = function __noSuchMethod__ (id, args) { | |
var numTimes = /x([0-9]+)/.exec(id); | |
if (numTimes != null) { | |
for (var i = 0;i < numTimes[1]; i++) { | |
if (typeof args[0] == 'function') { | |
args[0](); | |
} else { | |
system.console.log(args[0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prototype | |
new Ajax.Request("/your/mom", onSuccess: function(response) { $("lightbox_content").innerHTML = response.responseJSON.contents }) | |
// jquery | |
$.getJSON("/your/mom", function(json) { $("#lightbox_content").html(json.contents) }) | |
// XUI | |
x$(window).xhrjson( "/your/mom", {map:{'contents':'#lightbox_content'} }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
system.use("com.joyent.Sammy"); | |
function resources( name , options) { | |
// var db = new DebugConsole(); | |
// system.console.log(db.processMessage(this.name)); | |
name = name.toLowerCase(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using XUI FX - Tween | |
x$('#add').click(function(){ | |
// This fails, blue fires before red is finished | |
x$('#baz').tween({ background:'red' }).tween({ background:'blue'}); | |
// This also doesn't work as expected. | |
x$('#baz').tween([{ background:'red' },{ background:'blue'}]); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ show me your pic | |
- ^addMessageProp(icon_url, http://laorquesta.mx/wp-content/uploads/2014/12/bikers-300x225.jpg) Does this make you smile? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ 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: |