This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// widget.js | |
/* | |
Compute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed | |
*/ | |
var AttributeTypes = null; | |
Widget.prototype.computeAttributes = function() { | |
var changedAttributes = {}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Convert a number to a string, rounding off apparent floating-point error. | |
Developed by Evan Balster for the TiddlyWikiFormula plugin. | |
Rules: | |
- Don't change the integer part. | |
- Don't change the first significant digit. | |
- Preserve the exponential part. | |
- Upon encountering five or more fractional 0s, round them off. | |
- Upon encountering five or more fractional 9s, round them up. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# GCloud startup script to auto-restart any instances with 'revive' tag. | |
# The calling machine must have Read/Write access to compute API!! | |
# I use this to reboot preemptible instances. | |
# Output is logged to /tmp/revive.log | |
indent() { sed 's/^/ /'; } | |
revive_instances() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
// Functions optimized for worst-case error, accept any finite positive y | |
/* | |
approximate x^0.5 with 1 newtonian steps, x=[1,4] | |
RMS error: 0.000228909 | |
mean error: 0.00017966 | |
worst error: 0.000601098 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -u | |
ASC_PROVIDER="$1" | |
ASC_USERNAME="$2" | |
ASC_PASSWORD="$3" | |
BUNDLE_ID="$4" | |
BUNDLE_PKG="$5" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableDelayedExpansion | |
cd %~dp0 | |
echo | |
set /p FOLDER=Name directory: | |
echo ... Multiple training phrases or penalized phrases may be separated with vertical bar characters... | |
echo ... Penalized phrases will be avoided in image generation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <memory> | |
#include <thread> | |
#include <atomic> | |
/* | |
weak_anchor is used to produce weak_ptr to a non-heap object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <atomic> // Requires C++11 or a suitable polyfill | |
/* | |
A reference counting guard for reusable objects. | |
Works similar to the mechanisms of weak_ptr. | |
Any number of accessors may visit() the passage if not closed. | |
After successful entry they should call exit(). | |
*/ | |
struct visitor_guard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PLAID_ASYNC_RING_H | |
#define PLAID_ASYNC_RING_H | |
#include <algorithm> | |
namespace plaid | |
{ | |
/* | |
This class houses general-purpose logic for managing asynchronous ringbuffers. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_CircuitPlayground.h> | |
const long FrameDT = 16; | |
unsigned long frame_index = 0; | |
unsigned long frame_mark = 0; | |
struct Timer |
OlderNewer