Skip to content

Instantly share code, notes, and snippets.

View gjesse's full-sized avatar
🤘
message not available

Jesse Hodges gjesse

🤘
message not available
View GitHub Profile
package com.lithium.java8.chapter3;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;
public class Advanced {
public static void main(String[] args) {
@gjesse
gjesse / lithium-hmac.js
Created October 25, 2018 19:38
lithium hmac example
// get the crypto-js lib for hashing
var crypto = require('crypto-js');
// get and check the validity of the api key
var apiKey = req.headers['x-auth-apikey'];
if (apiKey !== "<your expected api key>") {
console.log("invalid api key provided")
res.status(401).end();
return;
}
import java.time.Duration
class CallActionBuilder {
val actions: MutableList<CallAction> = mutableListOf()
fun answer() {
actions.add(AgentAnswer())
}
fun pause(seconds: Long = 1) {
actions.add(Pause(Duration.ofSeconds(seconds)))