Skip to content

Instantly share code, notes, and snippets.

View ianjosephwilson's full-sized avatar

Ian Wilson ianjosephwilson

View GitHub Profile
class BatchIterator(object):
"""
Return batches of items of batch size or less from the given source.
Each batch is another iterator.
"""
def __init__(self, source, batch_size=900):
self.source_iter = iter(source)
self.batch_size = batch_size
self.stop_iteration = False
function startWatchingTagSettings() {
var request = null, timeout = null, temp = null, rate = 300;
$scope.$watch('tagSettings', function (val, oldVal) {
if (val === oldVal) {
// Special case where we are called durining initialization.
return;
}
temp = val;
if (timeout) {
$timeout.cancel(timeout);
def _render(template, **kwargs):
kwargs['constants'] = constants
return template.render(**kwargs)
//a data pin
//b clock pin
//r result
//w poll timeout
// @TODO: Improvements
// If ack fails reboot scout with scout.boot.
// If polling fails reboot scout with scout.boot.
function sht.temp.report {
//a data pin
//b clock pin
//r result
//w poll timeout
function sht.temp.report {
print "s.r.t";
f = key(arg(1));
hq.report("rawtemp", f);
free f;
//a data pin
//b clock pin
//c control variable, temperature or humidity or nothing
//m most sig
//l least sig
//r result
//w waiting for d4
function sht.report {
print "sht.report";
/**************************************************************************\
* Pinoccio Library *
* https://github.com/Pinoccio/library-pinoccio *
* Copyright (c) 2014, Pinoccio Inc. All rights reserved. *
* ------------------------------------------------------------------------ *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the MIT License as described in license.txt. *
\**************************************************************************/
#include <SPI.h>
#include <Wire.h>
import logging
from trytond.model import Workflow, ModelView, ModelSQL, fields
from trytond.pyson import Eval, Or, And, Not, Bool, Equal
from trytond.wizard import Wizard, StateView, StateTransition, Button
from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
from trytond.rpc import RPC
__metaclass__ = PoolMeta
function works() {
var promise = getPromise();
promise.then(first_success, first_error);
promise.then(second_success, second_error);
return promise;
}
function doesNotWork() {
var promise = getPromise();
promise.then(first_success, first_error).then(second_success, second_error);
controllers.controller('MainCtrl', function( $scope, $location,
AuthService, NoteService, _, ga ){
$scope.user = null;
$scope.showSearch = false;
window.console.log('what is happening');
window.console.log('_', _, typeof _);
window.console.log('ga', ga, typeof ga);
// ...
});