Skip to content

Instantly share code, notes, and snippets.

View sgrove's full-sized avatar
💭
The real friends were the models we made along the way

Sean Grove sgrove

💭
The real friends were the models we made along the way
View GitHub Profile
@sgrove
sgrove / google_maps.gql
Created July 14, 2018 01:29
Google Maps (Reverse+) Geolocation and Elevation API
{
google(auths: { googleMapsKey: "..." }) {
maps {
intersection: geolocation(address: "Eddy & Franklin St, San Francisco, CA") {
...fullMap
}
point: reverseGeolocation(
point: { lat: 37.7478646802915, lng: -122.4578673697085 }
) {
...fullMap
@sgrove
sgrove / onegraph.gql
Last active July 12, 2018 21:14
Example multi-service query with OneGraph and GraphQL
{
## Retrieve a YouTube video by its id
youTubeVideo(id: "YX40hbAHx3s") {
snippet {
# Pull out the title
title
# Jump to the channel the video was uploaded to
uploadChannel {
snippet {
# Get the title of the channel
[
{
"created_at": "Thu Apr 06 15:28:43 +0000 2017",
"id": 850007368138018817,
"id_str": "850007368138018817",
"text": "RT @TwitterDev: 1/ Today we’re sharing our vision for the future of the Twitter API platform!nhttps://t.co/XweGngmxlP",
"truncated": false,
"entities": {
"hashtags": [],
"symbols": [],
@sgrove
sgrove / curl_async.ml
Last active February 11, 2019 12:24
Bad interaction between Async wrapper around ocurl and httpaf
[@@ocaml.doc " Async support for Curl, see https://github.com/ygrek/ocurl/blob/master/curl_lwt.ml "]
module M = Curl.Multi
type interrupt = unit Async.Ivar.t
type multi =
{
mt: Curl.Multi.mt ;
all_events: (Unix.file_descr, interrupt list) Hashtbl.t ;
wakeners: (Curl.t, Curl.curlCode Async.Ivar.t) Hashtbl.t }
@sgrove
sgrove / curl->clj.clj
Last active August 18, 2021 14:27
Convert Chrome's `copy-as-curl` to clj-http calls
(defn curl->clj*
"Given a (single) curl string from Chrome's copy-as-curl, convert it either
into a clj-http call, a task-based http entry, or a shortened
task-based entry"
([curl-str]
(curl->clj* curl-str {}))
([curl-str conv-opts]
(let [clean-opts (:clean conv-opts)
merge-opts (:merge conv-opts)
headers (->
@sgrove
sgrove / Test.re
Last active December 9, 2016 18:37
/**
* Welcome to Reason.
*/
open Lwt;
open Cohttp;
open Cohttp_lwt_unix;
let body =
@sgrove
sgrove / console.re
Created December 8, 2016 17:20
Example Reason+Bucklescript bindings
external log : 'anything => unit = "console.log" [@@bs.val];
external trace : 'anything => unit = "console.trace" [@@bs.val];
@sgrove
sgrove / build
Created September 10, 2015 17:48
$ lein cljsbuild once pseudo
Compiling ClojureScript.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/s/.m2/repository/ch/qos/logback/logback-classic/1.1.2/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/s/.m2/repository/org/slf4j/slf4j-log4j12/1.6.2/slf4j-log4j12-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
10:34:17.824 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
10:34:18.666 [main] DEBUG com.amazonaws.AmazonWebServiceClient - Internal logging succesfully configured to commons logger: true
10:34:18.813 [main] DEBUG com.amazonaws.metrics.AwsSdkMetrics - Admin mbean registered under com.amazonaws.management:type=AwsSdkMetrics
10:34:19.620 [main] DEBUG c.a.internal.config.InternalConfig - Configuration override awssdk_config_override.json not found.
@sgrove
sgrove / example.clj
Created September 10, 2015 15:33
cljs + webpack interop sketch
;; Example config
:libs [;; Provides is what you would (:require [ReactMotion :as rm
;; and ends up as exports.ReactMotion
{:provides ["ReactMotion"]
:native-name ["react-motion"]
:preprocess :webpack
:webpack-options {. .}}
{:provides ["React"]
:native-name ["react"]
:preprocess :webpack
@sgrove
sgrove / core.cljs
Created September 9, 2015 16:40
ReactMotion + ClojureScript
(ns motionable.core
(:require [om.core :as om]
[om.dom :as dom]
[React :as r :refer [createElement createClass render]]
[ReactMotion :as rm]))
(enable-console-print!)
(def app-state
(atom {:text "Hello world!"}))