Skip to content

Instantly share code, notes, and snippets.

curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "X-Auth-Token: INSERT_TOKEN" \
--header "Cookie: asdsadsafasasdasd" \
--data-binary "{
\"fromLocation\": \"BUD\",
\"toLocation\": \"LON\",
\"departureDate\": \"2014-05-15T00:00:00\",
\"returnDate\": \"2014-05-20T00:00:00\",
@morgz
morgz / view_helpers.ex
Last active November 29, 2019 12:23
PowAssent.Phoenix.ViewHelpers - Enabling adding params to link generation and restructuring the link methods so view can just access paths for greater flexibility.
defmodule PowAssent.Phoenix.ViewHelpers do
@moduledoc """
View helpers to render authorization links.
"""
alias PowAssent.Plug
alias PowAssent.Phoenix.AuthorizationController
alias Phoenix.{HTML, HTML.Link}
import Logger
@morgz
morgz / magic_link_controller.ex
Created December 6, 2019 11:49
A sample phoenix controller for implementing magic links with POW, Phoenix & JWT (Guardian)
ApolloService.shared.client.store.withinReadWriteTransaction({ transaction in
let deletedDroidId = "..."
//
// Update the Query
//
let query = DroidListQuery()
// Update Cache for a Query on a deletion
try transaction.update(query: query) { (data: inout DroidListQuery.Data) in
#include <Wire.h>
void setup() {
Serial.begin(115200); // Start serial communication at 115200 baud rate
while (!Serial); // Wait for serial port to connect
Serial.println("\nI2C Scanner");
Wire.begin(); // Initialize I2C communication
}
void loop() {
@morgz
morgz / SetDateTime.ino
Last active April 19, 2024 14:22
RTC Testing
/*
RV-3028-C7 Set Date Time Example
Configures date and time to the RTC module via the serial console, and then
prints the current date and time in ISO 8601 format every second.
Copyright (c) 2020 Macro Yau
https://github.com/MacroYau/RV-3028-C7-Arduino-Library
*/
#include "Adafruit_TinyUSB.h"
#include <SPI.h>
// Define your custom SPI pins
// UM Feather WORKING
// #define MY_MOSI_PIN 35
// #define MY_MISO_PIN 37
// #define MY_CLK_PIN 36
// #define MY_CS_PIN 38
// #define MY_INT_PIN 33
#include <esp_sleep.h>
// Define the pin connected to the V_USB signal
#define WAKEUP_PIN GPIO_NUM_19
void printWakeupReason() {
esp_sleep_wakeup_cause_t wakeup_reason = esp_sleep_get_wakeup_cause();
switch (wakeup_reason) {
case ESP_SLEEP_WAKEUP_EXT0: