This file contains hidden or 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
(defn get-repos [page per_page] | |
(let [options (merge base-options {:query-params {:per_page per_page :page page}})] | |
(let [{:keys [headers body error]} @(http/get repo-url options)] | |
(if error | |
(throw error) | |
{:body (json/read-str body :key-fn keyword) :has_next (str/includes? (get headers :link) "rel=\"next\"")})))) |
This file contains hidden or 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
(def link (get-in @(http/get repo-url base-options) [:headers :link])) | |
;; link is a comma-delimited array of relative pages | |
(println link) | |
; => <https://github.com/api/v3/organizations/<id>/repos?page=2>; rel="next", <https://github.com/api/v3/organizations/<id>/repos?page=9>; rel="last" | |
;; Do we have a next page? | |
(def have_next (str/includes? link "rel=\"next\"")) | |
(println have_next) | |
; => true |
This file contains hidden or 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
(http/get repo-url base-options) ; => returns a promise | |
@(http/get repo-url base-options) ; => blocks until promise completes - returns a map | |
(get @(http/get repo-url base-options) :status) ; => can get the :status from the map - returns 200 |
This file contains hidden or 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
(def test-map {:error nil :status 200}) ;=> #'user/test-map | |
(get test-map :status) ;=> 200 |
This file contains hidden or 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
(def user-auth ["<username>" "<personal-access-token>"]) | |
(def base-url "https://github.com/api/v3/") | |
(def org-name "orgs/<your-org-name>") | |
(def repo-url (str base-url org-name "/repos")) | |
(def base-options {:basic-auth user-auth :headers {"Accept" "application/vnd.github.v3+json"}}) |
This file contains hidden or 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
(require '[org.httpkit.client :as http]) | |
(require '[clojure.data.json :as json]) | |
(require '[clojure.string :as str]) |
This file contains hidden or 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
{:deps | |
{http-kit {:mvn/version "2.5.0"} | |
org.clojure/data.json {:mvn/version "1.0.0"} | |
org.clojure/core.async {:mvn/version "1.3.610"}}} |
This file contains hidden or 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
void loop() | |
{ | |
if (millis() - lastGPSTime > 500) { | |
lastGPSTime = millis(); // Update the timer | |
latitude = myGPS.getLatitude(timeout); | |
longitude = myGPS.getLongitude(timeout); | |
speed = myGPS.getGroundSpeed(timeout); | |
satellites = myGPS.getSIV(timeout); | |
This file contains hidden or 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
void setup() | |
{ | |
// Setup User Terminal | |
Serial.begin(115200); // UART to PC/Mac | |
while(!Serial); | |
Serial1.begin(9600); // UART to GPS | |
while(!Serial1); | |
// Initialize digital pin LED_BUILTIN as an output. | |
pinMode(LED_BUILTIN, OUTPUT); |
This file contains hidden or 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
#include <SparkFun_Ublox_Arduino_Library.h> | |
#include <Arduino_LSM9DS1.h> | |
#include <Arduino_APDS9960.h> | |
#include <SPI.h> | |
#include <SD.h> | |
// SD Vars | |
File dataFile; | |
int chipSelect = 4; |