Skip to content

Instantly share code, notes, and snippets.

@kolohelios
kolohelios / machine.js
Last active April 18, 2020 21:16
Generated by XState Viz: https://xstate.js.org/viz
const weekdays = [ 'mon', 'tue', 'wed', 'thu', 'fri' ];
const weekends = [ 'sat', 'sun' ];
const everyday = [ ...weekdays, ...weekends ];
const allButtons = {
MON: 'mon',
TUE: 'tue',
WED: 'wed',
THU: 'thu',
FRI: 'fri',
@kolohelios
kolohelios / fizzbuzz-user-supplied.py
Last active June 2, 2016 01:32
Fizz Buzz - with user-supplied values
import sys
# Check the command line argument; if there's no value, make sure we get one
# from user input; if it's invalid, we will let the user know.
try:
max_value = int(sys.argv[1])
except IndexError:
invalid_value = True
except ValueError:
print('You did not pass a valid argument (a positive whole number).\n')
@kolohelios
kolohelios / SquidSphere_2.5
Created February 21, 2015 01:38
This program will operate the squid sphere which consists of three three-color LEDs.
/* Jon Edwards
v 2.6, 1Nov2014
This program will operate the squid sphere which consists of three
three-color LEDs; because the three-color LEDs have a common anode,
setting them HIGH will turn them off while setting them LOW will turn
them on. This will need to be kept in mind when setting the analogWrite
values that will be backwards (255 for off and 0 for on) */
// a new month, a new rewrite
// simple things are often better things
@kolohelios
kolohelios / Xmas_Lights
Created February 20, 2015 06:03
Arduino program to use a 74HC595 shift register connected to AC relays to control Christmas tree lights.
/*******************************************************************
* Arduino Uno-based Solid State Relay Controller, uses 74HC595 *
* 24Nov13 *
* Rev 0.3 *
* by Jon Edwards *
* 74HC595 pins: *
* 1 out2, 2 out3, 3 out4, 4 out5, 5 out6, 6 out7, 7 out8, 8 gnd *
* 9 serout, 10 MR (high), 11 SH_CP, 12 ST_CP, 13 OE (low), 14 DS, *
* 15 out 1, 16 VCC * *
*******************************************************************/
@kolohelios
kolohelios / quotehtmltabletocsv
Created February 20, 2015 05:44
I created this JavaScript as a Chrome Extension to save a CSV file from a specific table from a proprietary ERP system.
function CheckForQuotationMarksAndCommas(textToCheck)
// add functionality to check for commas
{
//console.log(textToCheck + " is a " + typeof(textToCheck));
textToCheck = textToCheck.replace(/,/g, ' ');
if (textToCheck == '\"')
{
return "\'";
}
else