Skip to content

Instantly share code, notes, and snippets.

@andrewminerd
andrewminerd / gist:12e90f7b7ac9ba599336fc10a50bc85a
Created April 10, 2020 19:08
Updating cables.gl patch.js for iOS
In patch.js..
#1) Look for:
c=document.createElement("video");
Add the following after the semicolon:
c.setAttribute('playsinline',1);
Should now look something like...
...,c=document.createElement("video");c.setAttribute('playsinline',1);const d="webcam"+CABLES.uuid();...
@andrewminerd
andrewminerd / IdGenerator.java
Created April 11, 2012 02:15
Snowflake in Java
package snowflake;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.atomic.AtomicLong;
/**
* Generates unique 64-bit IDs based on a host ID, timestamp, and
* incrementing counter. When each instance is given a unique host ID,
@andrewminerd
andrewminerd / accept_lang.php
Created October 7, 2011 18:33
Accept-Language Header
<?php
$value = "en-us,en;q=0.7,ar-iq;q=0.3";
$accepted = array();
if (preg_match_all("/\s*([^,;]+)(?:;\s*q=([\d.]+))?/", $value, $m, PREG_SET_ORDER)) {
foreach ($m as $lang) {
$accepted[] = array(
'lang' => $lang[1],
'q' => isset($lang[2]) ? (float)$lang[2] : 1
@andrewminerd
andrewminerd / nmea.cs
Created August 4, 2011 04:17
Simple C# NMEA (GPS) parser, made for the Netduino
using System;
namespace Nmea
{
class Parser
{
private enum STATES : byte
{
begin, body, checksum1, checksum2, checksum_lr, checksum_cf, cf
}