Skip to content

Instantly share code, notes, and snippets.

View thure's full-sized avatar
🏳️‍🌈

Will Shown thure

🏳️‍🌈
View GitHub Profile
@thure
thure / dark-scrollbar.as.css
Last active January 28, 2020 04:08 — forked from Sporif/dark-scrollbar.as.css
Dark scrollbar for Firefox 57. Tested on Windows 10. Requires https://gist.github.com/Sporif/db6b3440fba0b1bcf5477afacf93f875
@media (prefers-color-scheme: dark) {
scrollbar, scrollbar *, scrollcorner {
-moz-appearance: none !important;
--scrollbar-width: 10px;
--scrollbar-height: var(--scrollbar-width);
}
scrollbar, scrollcorner {
background: #282828 !important;
}
@thure
thure / climb.js
Last active January 5, 2017 15:05
/**
* Climbs up the DOM up to but not including the limit element (or
* `body` if not specified) looking for and returning the first
* element that passes the predicate, or `null` if nothing does.
*
* @param {HTMLElement} start
* @param {function} predicate
* @param {HTMLElement} limit
* @returns {*}
*/
module.exports = function (options) {
return new Promise(function (resolve, reject) {
var req = new XMLHttpRequest();
req.open(options.method || 'GET', options.url, true);
// Set request headers if provided.
Object.keys(options.headers || {}).forEach(function (key) {
Public Sub AutoDeclineInvitation(Item As Outlook.MailItem)
Dim cAppt As AppointmentItem
Dim oResponse
Set cAppt = GetCurrentItem.GetAssociatedAppointment(False)
If cAppt.ReminderSet Then
Set oResponse = cAppt.Respond(olMeetingDeclined, True)
Else
GetCurrentItem.GetAssociatedAppointment(True)
@thure
thure / three-renderpass.js
Last active August 29, 2015 14:19
An AMD definition of alteredq's THREE.RenderPass object.
/**
* @author alteredq / http://alteredqualia.com/
*/
define(function(require, exports, module){
var THREE = require('three');
function RenderPass ( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
@thure
thure / 1.1: Why state machines?.md
Last active February 6, 2023 14:56
SCXML Tutorials

Fundamentals: why state machines?

States. The final frontier. These are the voyages of an enterprising developer. Her eternal mission: to explore strange new techniques, to seek out better ways to engineer for mental models and new design patterns. To boldly go where a few awesome devs have gone before.

So you’ve found our poignant guide to SCXML and surely you’re wondering “Why should I want to go out of my way to use formal state machines?” or something like that. Hopefully this introduction addresses that kind of question.

An example: Nancy’s RPG

The problem

<!doctype html>
<html>
<head>
<style>
body {
/* put the URL of the image you want to use in this rule: */
background-image: url('http://imgs.xkcd.com/comics/loop.png');
/* put the color you want to use for the negative space in this rule: */
background-color: #ccc;
var touchViewport = new Hammer(document.documentElement);
touchViewport.on('swipeleft', navRight);
touchViewport.on('swiperight', navLeft);
@thure
thure / hcr.js
Last active April 12, 2018 12:32
Heliocentric coordinates from Kepler orbit and time
var moment = require('moment');
module.exports = function(/* orbit, [Date, time String], [format String], [etc] */){
// Takes an orbit definition of the kind used in GEOF stellar-objects and
// remaining arguments as moment arguments, returning heliocentric
// rectangular coordinates in α's unit (probably AU).
// TODO: Does not yet take into account changes in orbit over time.
// TODO: Converts between degrees and radians too often, I think.