Skip to content

Instantly share code, notes, and snippets.

View dbabbs's full-sized avatar
Focusing

Dylan Babbs dbabbs

Focusing
View GitHub Profile
@dbabbs
dbabbs / useAnimationFrame.js
Last active December 7, 2020 18:10
React hook for requestAnimation Frame
/* Usage:
import { useState } from 'react';
import useAnimationFrame from '../../hooks/useAnimationFrame';
const [animationActive, setAnimationActive] = useState(true);
useAnimationFrame(() => {
//perform action here
}, animationActive);
*/
@dbabbs
dbabbs / index.html
Last active October 17, 2019 09:21
harp.gl + react (basic)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
<style>
body, html { border: 0; padding: 0; margin: 0}
#root {
height: 100vh;
width: 100%;
cameras:
camera1:
type: perspective
sources:
xyz_osm:
type: MVT
url: https://xyz.api.here.com/tiles/osmbase/256/all/{z}/{x}/{y}.mvt
max_zoom: 16
layers:
@dbabbs
dbabbs / index.js
Last active March 12, 2019 17:42
Tangram map real quick
#!/usr/bin/env node
const fs = require('fs');
const name = 'tangram-skeleton';
const html =
`<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@dbabbs
dbabbs / index.js
Last active February 19, 2019 21:16
playing around with npx
#!/usr/bin/env node
const fs = require('fs');
// const args = require('minimist')(process.argv.slice(2));
const opn = require('opn')
// console.log(args);
// const name = args['n'];
// const id = args['id'];
// const code = args['code']
const name = 'here-template';
console.log(name)
["Dylan", "Toly", "Jayson", "Another name"]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[{"route":"Seattle Tacoma International Airport - San Diego International Airport","path":[[-122.308998,47.44900100000001],[-122.24418413738735,47.30167540935691],[-122.17973054599418,47.15431348085915],[-122.1156334717979,47.00691560196577],[-122.05188920883074,46.859482155008315],[-121.9884940984203,46.71201351727545],[-121.92544452844372,46.56451006109574],[-121.86273693259558,46.41697215391899],[-121.80036778966907,46.26940015839592],[-121.73833362284977,46.121794432456404],[-121.67663099902268,45.9741553293862],[-121.61525652809127,45.82648319790219],[-121.55420686230899,45.67877838222623],[-121.49347869562268,45.53104122215763],[-121.43306876302769,45.383272053144246],[-121.37297383993437,45.23547120635218],[-121.31319074154622,45.08763900873432],[-121.25371632224854,44.9397757830975],[-121.19454747500814,44.79188184816838],[-121.1356811307839,44.64395751865821],[-121.0771142579472,44.496003105326324],[-121.01884386171295,44.3480189150425],[-120.96086698358043,44.20000525084814],[-120.90318070078386,44.
import UIKit
import SCSDKCreativeKit
import CoreLocation
class ViewController: UIViewController, CLLocationManagerDelegate {
var locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
@objc func send() {
let img = createMapImage()
let sticker = SCSDKSnapSticker(stickerImage: img)
let snap = SCSDKNoSnapContent()
snap.sticker = sticker
snap.attachmentUrl = "https://developer.here.com"
let api = SCSDKSnapAPI(content: snap)
api.startSnapping { (error) in }
}