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 fs = require('fs'), | |
_ = require('underscore'), | |
markdown = require('markdown').markdown, | |
tinymake = require('tinymake'); | |
// all posts are .md (markdown files) | |
var posts = _.filter(fs.readDirSync('posts'), function(name){ | |
return name.match(/\.md$/) | |
}); | |
var pages = []; |
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 username, password, creds; | |
var challenge = function( res ) { | |
res.writeHead( 401, { 'WWW-Authenticate': 'Basic realm="Acme Web Application"'} ); | |
res.end(); | |
}; | |
if ( req.headers.authorization ) { | |
creds = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString('utf8').split(':'); | |
username = creds[0]; | |
password = creds[1]; | |
// authenticate here |
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 cmRecipe = Packages.net.canarymod.api.recipes.CraftingRecipe; | |
var cmRecipeRow = Packages.net.canarymod.api.recipes.RecipeRow; | |
// see https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/inventory/recipes/CraftingRecipe.html | |
var rows = [ | |
new cmRecipeRow("ESW", [ enderPearl, stick, string]), | |
new cmRecipeRow("SEW", [ stick, enderPearl, string]), | |
new cmRecipeRow("ESW", [ enderPearl, stick, string]) | |
]; | |
var signature = "(net.canarymod.api.inventory.Item, net.canarymod.api.inventory.recipes.RecipeRow[])"; | |
var enderBowRecipe = new cmRecipe[signature]( enderBow, rows); |
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
'use strict'; | |
/*global require, events, server, Packages*/ | |
var slash = require('slash'); | |
slash([ | |
'groupmod permission add visitors canary.world.build', | |
'groupmod permission add visitors scriptcraft.evaluate' | |
],server); | |
/* | |
WARNING: The following code makes all players ops. | |
Only use this for local servers . |
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
function bounceOnSponge(event){ | |
var player = event.player; | |
var location = player.location; | |
// need to convert coordinates to integers | |
var x = Math.floor(location.x); | |
var y = Math.floor(location.y - 1 ); // what's underfoot? | |
var z = Math.floor(location.z); | |
var block = location.world.getBlockAt(x, y, z); | |
if (block.typeId === blocks.sponge){ | |
player.motionY = 2; // springs player high into air |
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 mqtt = require('sc-mqtt'), | |
slash = require('slash'), | |
client = mqtt.client('tcp://localhost:1883','sc-ard-light'), | |
preDawn = 22000, | |
JavaString = java.lang.String; | |
client.connect(); | |
client.subscribe('arduino-light'); | |
var max = 0; | |
function updateTime(topic, message){ |
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
/*global require, events */ | |
var blocks = require('blocks'), | |
sounds = require('sounds'); | |
var bouncers = {}; | |
function bounceOn___(event){ | |
var player = event.player; | |
var id = player.ID; | |
var bounce = bouncers[id] || 0.75; // get bounciness (default 0.75) | |
var location = player.location; |
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
/*global require, events */ | |
var blocks = require('blocks'), | |
sounds = require('sounds'); | |
function bounceOn___(event){ | |
var player = event.player; | |
var bounce = 0.75; | |
var location = player.location; | |
// need to convert coordinates to integers | |
var x = Math.floor(location.x); |
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 Drone = require('drone'); | |
var blocks = require('blocks'); | |
function skyscraper( floors ) { | |
var i = 0; | |
if ( typeof floors == 'undefined' ) { | |
floors = 10; | |
} | |
this.chkpt('skyscraper'); | |
for ( i = 0; i < floors; i++ ) { | |
this |
OlderNewer