Skip to content

Instantly share code, notes, and snippets.

Avatar

Damon Oehlman DamonOehlman

View GitHub Profile
@kawazoe
kawazoe / force-reload.js
Last active Jan 22, 2021
Auto refresh page on manifest.json change. iOS offline PWA hack to handle auto updates.
View force-reload.js
// ------------------------------------------- IMPORTANT -------------------------------------------
// This is a development file to be minified using https://javascript-minifier.com/ and inlined in
// the index.html file. This file is not compiled or processed by webpack so it should be treated as
// low-level precompiled es5-compatible javascript. The code here is not meant to be clean, it's
// meant to be as light and fast as possible since it runs in the head tag.
// HACK: This file a hack to ensure that home-screen apps on mobile devices gets refreshed when they
// start. It works by forcing a load of the service-worker.js file and use the precache-manifest
// file name as an application version, just like a desktop browser like chrome would do. When
// when it detects a change in the application version, it reloads the page and bypass the browser's
View |>.markdown

Assume concat is some function sticking two strings together, and uppercase is... well:

Haskell (argument application):

> let a |> f = f a

> "def"
    |> (\x -> concat "abc" x)
    |> uppercase                      -- (\x -> uppercase x) if you want to be explicit.
@creationix
creationix / shed.scad
Last active Sep 25, 2020
Shed design. Open in OpenScad to view 3d model.
View shed.scad
windows = false; // show windows
stuff = false; // Show bikes, table, mower
l = 32; // Length of building in feet (16, 20, 24, 28, 32, ...)
h = 8*12-4.5+.5;
rl=6*12+1.375+.1; // cut to 73.5" long with 22.5 degree angles
tl = 68.7; // Used to tweak headers on top walls
// 2x6 concrete forms for foundation
// 10" wide grid
@dansilivestru
dansilivestru / .bithoundrc
Last active Mar 25, 2019
default .bithoundrc file for ignoring project files (modify as needed and commit to the root of your project)
View .bithoundrc
{
"ignore": [
"**/deps/**",
"**/node_modules/**",
"**/thirdparty/**",
"**/third_party/**",
"**/vendor/**",
"**/**-min-**",
"**/**-min.**",
"**/**.min.**",
@morganherlocker
morganherlocker / voxel-openstreetmap.md
Last active Aug 29, 2015
voxel osm vector tile algo
View voxel-openstreetmap.md

This is a rough spec for an implementation of a realtime virtual world using OpenStreetMap data and voxel.js. The basic idea is to encode feature data pulled from Mapbox vector tiles as overzoomed tiles, which can be represented as voxels. This allows for easy scalability, since it utilizes existing algorithms and architecture.

The initial implementation is going on here.

###general

  • 1 voxel = 1 tile at zoom 17 = 1.1943 sq meters
  • the world is a 33,554,432 x 33,554,432 voxel grid
  • assume that a server is serving up vector tile pbfs at z15 (mapbox.com, local, etc.)
  • vector tiles are loaded at zoom 15 and geometry is encoded as 4096x4096 pixel coordinates, which is equivalent to tiles at zoom 24
@tmpvar
tmpvar / offset-minkowski-surface-nets.js
Last active Aug 29, 2015
offsetting adventures (run these with beefy!)
View offset-minkowski-surface-nets.js
var Polygon = require('polygon');
var fc = require('fc');
var Vec2 = require('vec2');
var ndarray = require('ndarray');
var sn = require('surface-nets');
var cwise = require('cwise');
var fill = require('ndarray-fill');
var poly = new Polygon([
View a_nodebot_over_wifi.md

Taking your nodebot wifi

Controlling your nodebot using a USB cable is great and all, and obviously you could shell out and grab a sparkcore or some other dedicated controller but what if you've got a standard arduino and you want to take an existing nodebot wireless?

Bluetooth is an option and there's this excellent JohnnyFive wiki entry that will help you there. Bluetooth can be a bit flaky though and it's range is pretty lousy. You can also look at things like XBees and what not using point to point serial, but these are expensive and very fiddly to get working.

Really, what we want is a method of transferring data over a nice, simple, standard method, requiring little configuration, low cost and we can utilise a whole stack of the code we've already produced.

Enter the WiFi232 module. These little beauties are [available from AliExpress for $12 each](http://www.aliexpress.com/item/USR-WIFI232-T-wifi-to-uart-tt

@ajfisher
ajfisher / firmatatest.js
Last active Dec 22, 2019
Serial comms over hardware UART for Johnny-Five between Arduino and a Raspberry Pi
View firmatatest.js
var firmata = require('firmata');
var repl = require('repl');
var board = new firmata.Board('/dev/ttyAMA0',function(err){
//arduino is ready to communicate
if (err) {
console.log("err:" + err);
return;
}
console.log("Firmata Firing LEDs");
@valueof
valueof / user.behaviors.clj
Last active Jan 4, 2016
LightTable Configuration
View user.behaviors.clj
;; https://gist.github.com/antonkovalyov/8663025
{:+ {
;; The app tag is kind of like global scope. You assign behaviors that affect
;; all of Light Table here
:app [(:lt.objs.style/set-skin "light")]
;; The editor tag is applied to all editors
:editor [:lt.objs.editor/no-wrap
(:lt.objs.style/set-theme "solarized-light")
@legastero
legastero / gist:7127532
Last active Dec 26, 2015
Where to find XMPP/Jingle in JS resources
View gist:7127532