Skip to content

Instantly share code, notes, and snippets.

View GhostToast's full-sized avatar

Gustave F. Gerhardt GhostToast

View GitHub Profile
@GhostToast
GhostToast / profile.xml
Last active March 14, 2020 19:07
Tasker Profile for connecting Darkysky API to Pujie Black
<TaskerData sr="" dvi="1" tv="5.9.2">
<Profile sr="prof6" ve="2">
<cdate>1583089329361</cdate>
<edate>1583943323047</edate>
<flags>8</flags>
<id>6</id>
<mid0>4</mid0>
<nme>Darksky</nme>
<Time sr="con0">
<fh>-1</fh>
@GhostToast
GhostToast / moon.js
Last active February 28, 2020 13:05
Moon Phaser
function getMoonPhase(year, month, day){
var c = e = jd = b = 0;
if (month < 3) {
year--;
month += 12;
}
++month;
var c = 365.25 * year;
var e = 30.6 * month;
var jd = c + e + day - 694039.09; //jd is total days elapsed

Keybase proof

I hereby claim:

  • I am ghosttoast on github.
  • I am ghosttoast (https://keybase.io/ghosttoast) on keybase.
  • I have a public key ASBcHQS656ZVX8VFNSO8TOOSfUAx6pdoZHz5i1EvsXX2QQo

To claim this, I am signing this object:

Arduino: 1.8.8 (Linux), TD: 1.45, Board: "Teensy 3.6, Serial, 180 MHz, Faster, US English"
simpleneopixeldemo: In function 'void sendBit(bool)':
simpleneopixeldemo:68: error: '_SFR_IO_ADDR' was not declared in this scope
[port] "I" (_SFR_IO_ADDR(PIXEL_PORT)),
^
simpleneopixeldemo:92: error: '_SFR_IO_ADDR' was not declared in this scope
[port] "I" (_SFR_IO_ADDR(PIXEL_PORT)),
^
simpleneopixeldemo: In function 'void show()':
@GhostToast
GhostToast / darklight.xml
Created September 28, 2018 13:36
Wear OS watch face switching for Pujie Black with Tasker
<TaskerData sr="" dvi="1" tv="5.2.bf1">
<Task sr="task5">
<cdate>1534903890379</cdate>
<edate>1535060872098</edate>
<id>5</id>
<nme>DarkLight</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>37</code>
<ConditionList sr="if">
@GhostToast
GhostToast / areBarnaclesMollusks.js
Created February 9, 2018 19:49
Function to determine whether Baracles are Mollusks.
function areBarnaclesMollusks() {
return false;
}
@GhostToast
GhostToast / cache.php
Created July 26, 2017 15:30
pagely purge path not working
<?php
/**
* Cache functions.
*/
namespace SLC;
use PagelyCachePurge;
/**
@GhostToast
GhostToast / hex2dec.php
Last active August 29, 2015 14:04
Hex Conversions and Comparisons
/**
* Convert hex to decimal, taking care of '#' and length, for comparing hex values
*
* @param $hex
*
* @return number
*/
public function hex2dec( $hex ) {
if ( empty( $hex ) ) {
return $hex;
@GhostToast
GhostToast / hex-tint.php
Last active August 29, 2015 13:57
Change a hex value by a positive or negative percentage, whether it is 3 or 6 characters in length. Percentage based on max (255), not self. So 100% will always be "#FFFFFF", -100% will always be "#000000"
<?php
/**
* Tint hex color by a percentage
*
* @param string $hex - #FFFFFF or #FFF
* @param int $percentage - Positive or negative
*
* @return string Returns modified $hex, lighter or darker
*/
function hex_tint( $hex, $percentage=0 ) {
@GhostToast
GhostToast / optimization_test.php
Last active December 30, 2015 11:59
micro optimization!! each test now involves many tests, so average is calculated and indicated in comments. one test was run at a time.
<?php
$foo = 'foo';
$bar = 'bar';
$foobar = 'foobar';
$string = '';
$tests = array();
for ($z = 0; $z<1000; $z++){
$startTime = microtime(true);