This file contains hidden or 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
| 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 |
This file contains hidden or 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 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); |
This file contains hidden or 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
| def _render(template, **kwargs): | |
| kwargs['constants'] = constants | |
| return template.render(**kwargs) |
This file contains hidden or 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
| //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 { |
This file contains hidden or 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
| //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; |
This file contains hidden or 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
| //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"; |
This file contains hidden or 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
| /**************************************************************************\ | |
| * 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> |
This file contains hidden or 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
| 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 |
This file contains hidden or 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 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); |
This file contains hidden or 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
| 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); | |
| // ... | |
| }); |