Skip to content

Instantly share code, notes, and snippets.

View doronhorwitz's full-sized avatar

Doron Horwitz doronhorwitz

  • Tel Aviv, Israel
View GitHub Profile
@doronhorwitz
doronhorwitz / lazyVariable.js
Last active August 29, 2015 14:13
lazy variable initialization factory for AngularJS
/*
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;
});
@doronhorwitz
doronhorwitz / pn7150.py
Last active March 20, 2024 20:30
Use Python to read from NXP PN7120/PN7150
# 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.