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
// Package gochannels example of how to close a channel written by several goroutines | |
package gochannels | |
import ( | |
"math/big" | |
"sync" | |
) | |
// Publisher write sequences of big.Int into a channel | |
type Publisher struct { |
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
{ | |
"indentation" : { | |
"level" : "error", | |
"value" : 1 | |
}, | |
"no_tabs": { "level": "ignore"}, | |
"max_line_length": { "level": "ignore"}, | |
"no_spaces": {"level" : "error"}, | |
"line_endings" : { | |
"value" : "unix", |
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
func debounceChannel(interval time.Duration, output chan int) chan int { | |
input := make(chan int) | |
go func() { | |
var buffer int | |
var ok bool | |
// We do not start waiting for interval until called at least once | |
buffer, ok = <-input | |
// If channel closed exit, we could also close output |
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
open source projects of Leopoldo Lara Vazquez - Individual Contributor License Agreement v1.0 | |
Thank you for your interest in the open source projects of Leopoldo Lara Vazquez (the "Project"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Project must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Project and its users; it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete and sign, then submit this Agreement by filling this electronic form and pressing the Submit button at the end of this electronic form. Please read this document carefully before signing and keep a copy for your records. | |
You accept and agree to the following terms and conditions for Your present and future Contribut |
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 setReferenceId = { | |
getNext: function () { | |
var seq = db.sequences.findAndModify( { query: { _id: 'listings' } , update : { $inc : { sequence: 1} }, new: true, upsert: true }); | |
return seq.sequence; | |
}, | |
getCursor: function () { | |
return db.listings.find( { reference_id: { $exists: false } }, {}); | |
}, | |
setReference: function (id, ref) { | |
return db.listings.update({ _id: id}, { $set: { reference_id: ref }}); |