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
# https://gist.github.com/doronhorwitz/fc5c4234a9db9ed87c53213d79e63b6c | |
# https://www.nxp.com/docs/en/application-note/AN11697.pdf explains how to setup a demo of the PN7120/PN7150. | |
# With that demo comes an executable called 'nfcDemoApp'. This gist is a proof of concept for how to read from that | |
# executable in Python. | |
# The class (which is called PN7150, even though it also should support PN7120) reads the output from the PN7150 each | |
# time a tag is read. It finds the line starting with "Text :" and extracts out the text - which is the text stored | |
# by the NFC tag. | |
# The reading is done in a separate thread, which calls a callback with the text every time an NFC tag is read. |
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
/* | |
Uses the technique at: http://michaux.ca/articles/lazy-function-definition-pattern | |
Just declare this factory in your project. | |
Then to use it, inject it into the controller/directive/service where its required and use it like so: | |
var myLazyVar = lazyVariable(function(){ | |
//some heavy calculation here | |
return value; | |
}); | |