View irrigar.sh
#!/bin/sh
# Constantes indicando ON e OFF do relay
ON=1
OFF=0
# Hora e minuto que a irrigacao deve ocorrer
H_PERIOD=8
M_PERIOD=0
View benchmark.js
const amqplib = require('amqplib');
const connect = amqplib.connect('amqp://172.17.0.2:5672');
const QUEUE_NAME = 'benchmark';
const TOTAL_MESSAGES = process.argv[2] || 10;
let SEND_MESSAGES = 0;
let RECEIVED_MESSAGES = 0;
let sendingStartTime;
View handleJsonp.js
window.jsonpRequestQueue = {};
function handleJsonp(options) {
var callbackKey = options.callback || ("mithril_callback_" +
new Date().getTime() + "_" +
(Math.round(Math.random() * 1e16)).toString(36))
var script = $document.createElement("script")
// callback já existe, faz fila
if(typeof global[callbackKey] === 'function') {
View start-irrigation.sh
#!/bin/sh
## Usage example, starts and irrigates for 30 seconds:
## start-irrigation.sh 30
APP_PATH="/app"
relay-exp -i
force_stop() {
View placeholder-polyfill.js
;(function() {
var testInput = document.createElement('input');
if('placeholder' in testInput || 'placeHolder' in testInput) {
return false;
}
var inputs = document.querySelectorAll('input');
for(var i = 0, m = inputs.length; i < m; i++) {
var input = inputs[i];
var inputPlaceholder = input.getAttribute('placeholder');
View log.js
var log = /debug=true/.test(location.search) ? (function(nav) {
// ie
if(/MSIE/.test(nav) === true) return console.log;
return function() {
console.log.apply(console, arguments);
}
})(navigator.userAgent) : function() {};
View underplate.js
/**
* underplate it's just the template lib used by underscore lib. I just
* removed all underscore code to can use just the good template engine.
*
* All code here was writed by underscore team.
*
* Based at Underscore.js 1.5.2
*
* @licence The MIT License (MIT)
*/
View maker.js
/**
* Simples Lib de template para substituir apenas variáveis. Útil para montar URL
* de Webservices com parâmetros variáveis.
*
* @param {String} template
* @param {Json} obj Objetos que serão adicionados no template
* @returns {String}
*/
function maker(template, obj) {
var attr;
View phantomjs-printscreen.js
var page = require('webpage').create(),
system = require('system');
page.viewportSize = { width: 1024, height: 768 };
if(system.args.length < 2) {
console.log("Informe a URL para realizar o prinscreen.");
console.log("phantomjs http://www.uol.com.br/");
phantom.exit(1);
}