Skip to content

Instantly share code, notes, and snippets.

View DylanKojiCheslin's full-sized avatar

Dylan Koji-Cheslin DylanKojiCheslin

View GitHub Profile
@GeekVisit
GeekVisit / README.md
Last active February 1, 2023 05:20
24 Hour Freeze Warning

This checks openweathermap.org for the low temperatures for the next 24 hours and provides an alert to Home Assistant if outside temperature is or will go below freezing. Imperial (Farenheit) temperature is used and US Zip code is used, but the flow can easily be edited to long/latitude. See Forecast Api documentation for options. Make sure you update the "Get 5 Day Forecast" node to edit the url to put in your zip and token "http://api.openweathermap.org/data/2.5/forecast?zip=zip=[REPLACE_WITH_YOUR_ZIP_AND_COUNTRY_ID]&appid=[REPLACE_WITH_YOUR_API_KEY]&units=imperial" (api token you can get free at Openweathermap.org). The message states the first time the temperature dips below freezing and also states the lowest temperature in next 24 hours.

Screenshot of Flow

Example screenshot of Windows Desktop notification using [Homeassi

#1 import
try:
import configparser
except:
from six.moves import configparser
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import requests
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@capsulecorplab
capsulecorplab / automate_all_the_things.adoc
Last active December 28, 2020 20:40
a list of miscellaneous automation and productivity tools
@aderaaij
aderaaij / es6-spread-operator.js
Last active July 25, 2018 09:27
The spread operator can expand(spread) any iterable like an array or a string.
const avengers = ['Thor', 'The Hulk', 'Captain America'];
let guardians = ['Star Lord', 'Gamorra', 'Drax', 'Rocket', 'Groot'];
// Spread out arrays in a new array and put a new value in between them
const heroes = [...avengers, 'Loki', ...guardians];
// Adding new stuff to an array just got easier too
guardians = [...guardians, 'Mantis', 'Yondu', 'Nebula'];
// Or simply making a TRUE copy of an array
const avengersCopy = [...avengers];
@chriseth
chriseth / snarktest.solidity
Last active December 3, 2023 07:03
zkSNARKs test code
// This file is MIT Licensed.
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O
@jherax
jherax / is-private-mode.js
Last active March 19, 2024 18:29
Detect if the browser is running in Private mode - Promise based (last update: Feb 2020)
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
*
* Live demo:
* @see https://output.jsbin.com/tazuwif
*
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js
*

These examples are presented in an attempt to show how each coding styles attempts to or does not attempt to isolate side-effects. There are only 2 semantic elements in a barebone "Hello World" implementation:

  • Invocation of console.log
  • Declaration of HELLO_WORLD

Since every coding style can abstract away data into a parameter or variable, there is no point for us to show that. All implementations assume HELLO_WORLD is a constant that is always inlined. This way it reduces the variations we need to present. (To make an anology, if we were to implement incrementByOne, would we need to inline the number 1 or pass it in as parameter?)

CAVEAT/LIMITATION: All implementations also assume console is static global. In case of functional programming, console.log is asumed to be a function that can be passed around without further modification. (This is not the case in the browser, but that can be resolved with console.log.bind(console))

Declarative

@LatvianModder
LatvianModder / README.md
Last active April 19, 2017 14:16
New FTBUtilities Guide System for 1.9

New FTBUtilities Guide System for 1.9

Online guides

Any modder or modpack author can ask me to add their guide to the repo list, when this new feature is done. If a server wants to make a guide, they can do it from server side. All guides will be hosted online, but could also be downloaded and launched from offline-mode too. Modpacks that need a guide to be installed together with modpack (like FTB Infinity Evolved or Skyblock), can add the guide url / ID in config file OR just drop the guide in modpack/guide/ folder.

What are the advantages?

  1. I would not only make guides for my mods for Minecraft ingame, but I would also develop a web-app And possibly an Android app that would allow to view all guides online without even opening Minecraft