Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.
You've got two main options:
// MyType is a generic that we can pass different types when calling handleAsyncTask() | |
const handleAsyncTask = async function<MyType> (asyncFn: () => Promise<MyType | string>) : Promise<[boolean, MyType | undefined]> { | |
const result = await asyncFn(); | |
if (typeof result === 'string') { | |
return [true, undefined]; | |
} | |
return [false, result]; | |
} |
#!/bin/bash | |
set -e | |
# dependencies: | |
# - youtube-dl: https://ytdl-org.github.io/youtube-dl/ | |
# - ffmpeg: https://ffmpeg.org/ | |
# make sure youtube-dl dep exists | |
if ! command -v youtube-dl &> /dev/null | |
then |
Twitter abuses all media file uploads, each type in its own way. If we want to upload a good looking animation loop from some low-color, high-detail generative art, we have to game their system's mechanisms.
don't upload a video file, they will re-encode it into absolute 💩
create a GIF, which they will auto-convert into a video file 😱
The frames of the GIF will be resized to an even-sized width using an extremely naive algorithm. Your GIF should be an even size (1000, 2000,
ffmpeg -ss $INPUT_START_TIME -t $LENGTH -i $INPUT_FILENAME \ | |
-vf "fps=$OUTPUT_FPS,scale=$OUTPUT_WIDTH:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \ | |
-loop $NUMBER_OF_LOOPS $OUTPUT_FILENAME | |
# Change these placeholders: | |
# * $INPUT_START_TIME - number of seconds in the input video to start from. | |
# * $LENGTH - number of seconds to convert from the input video. | |
# * $INPUT_FILENAME - path to the input video. | |
# * $OUTPUT_FPS - ouput frames per second. Start with `10`. | |
# * $OUTPUT_WIDTH - output width in pixels. Aspect ratio is maintained. |
Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
ActivityTweet | |
generic_activity_highlights | |
generic_activity_momentsbreaking | |
RankedOrganicTweet | |
suggest_activity | |
suggest_activity_feed | |
suggest_activity_highlights | |
suggest_activity_tweet |
#!/usr/bin/env bash | |
URI="https://services1.arcgis.com/sTaVXkn06Nqew9yU/ArcGIS/rest/services/Political_Boundaries_Feb2016/FeatureServer/1/query?&outfields=*&f=geojson&where=objectid%20is%20not%20null" | |
ogr2ogr -f GeoJSON ca_assembly_districts.json $URI OGRGeoJSON |
This is a demonstartion of how to align arbitrary GeoJSON data to the us-atlas topojson data.
It's important to note that the TopoJSON from us-atlas
has it's map projection,
(d3.geoAlbersUsa), built into it. In other words,
it is considered "projected" geographic data.
This is an important distinction from GeoJSON data which is most typically stored in the unprojected Coordinate Reference System WGS84, also commonly referred to as "lat, lon" (though coordinates are most often stored in the order longitude, latitude).
I had a large dataset in postgis and wanted to avoid the hassle of first exporting it to a several GB geojson file before tiling it with Tippecanoe.
ogr2ogr -f GeoJSON /dev/stdout \
PG:"host=localhost dbname=postgres user=postgres password=thepassword" \
-sql "select * from a, roi where a.geom && roi.geom" \
| docker run -i -v ${PWD}:/data tippecanoe:latest tippecanoe \
--output=/data/yourtiles.mbtiles