Skip to content

Instantly share code, notes, and snippets.

View calaveraInfo's full-sized avatar

František Řezáč calaveraInfo

View GitHub Profile
@calaveraInfo
calaveraInfo / optional.java
Last active February 21, 2017 12:18
Java 8 Optional: using map + null return value is allowed, no need to do flatMap + ofNullable. http://calavera.info/v3/blog/2016/11/17/nic.html
@Test
public void testOptional() {
assertEquals(Optional.of(
new AClass())
.map(AClass::getSomeObject)
.map(BClass::getSomeText)
.map(String::trim)
.orElse(""), "");
assertEquals(Optional.of(
new AClass(new BClass()))
@calaveraInfo
calaveraInfo / ntag2xx_read.ino
Created January 23, 2016 19:01
Modified version of Adafruit ntag reader that outputs text from ntag to keyboard emulation.
/**************************************************************************/
/*!
@file readntag203.pde
@author KTOWN (Adafruit Industries)
@license BSD (see license.txt)
This example will wait for any NTAG203 or NTAG213 card or tag,
and will attempt to read from it.
This is an example sketch for the Adafruit PN532 NFC/RFID breakout boards
@calaveraInfo
calaveraInfo / Calavera_Fingerprint.cpp
Last active December 27, 2015 15:04
Adafruit fingerprint sensor with Arduino Micro
/***************************************************
This is a library for our optical Fingerprint sensor
Designed specifically to work with the Adafruit BMP085 Breakout
----> http://www.adafruit.com/products/751
These displays use TTL Serial to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
@calaveraInfo
calaveraInfo / rotary-encoder.ino
Last active December 27, 2015 14:59
Use rotary encoder with Arduino Micro to increase/decrease a value and show that value on SSD1306 display. Based on https://learn.adafruit.com/pro-trinket-rotary-encoder/example-rotary-encoder-volume-control
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_DC 6
#define OLED_CS 7
#define OLED_RESET 8
#define PIN_ENCODER_A 4 //Micro pin 4 - encoder A
#define PIN_ENCODER_B 6