Skip to content

Instantly share code, notes, and snippets.

View Olian04's full-sized avatar

Oliver Anteros Olian04

View GitHub Profile
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@kosamari
kosamari / _ServiceWorker_for_github_pages.md
Last active April 1, 2024 05:44
ServiceWorker for github pages.

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

# Name Type 1 Type 2 Total HP Attack Defense Sp. Atk Sp. Def Speed Generation Legendary
1 Bulbasaur Grass Poison 318 45 49 49 65 65 45 1 False
2 Ivysaur Grass Poison 405 60 62 63 80 80 60 1 False
3 Venusaur Grass Poison 525 80 82 83 100 100 80 1 False
3 VenusaurMega Venusaur Grass Poison 625 80 100 123 122 120 80 1 False
4 Charmander Fire 309 39 52 43 60 50 65 1 False
5 Charmeleon Fire 405 58 64 58 80 65 80 1 False
6 Charizard Fire Flying 534 78 84 78 109 85 100 1 False
6 CharizardMega Charizard X Fire Dragon 634 78 130 111 130 85 100 1 False
6 CharizardMega Charizard Y Fire Flying 634 78 104 78 159 115 100 1 False
@Halkcyon
Halkcyon / GW2.cmd
Last active March 1, 2022 17:30 — forked from OneFaced/UpdateArcDps.cmd
Automatically update ArcDps and BuildTemplates from deltaconnected for Guild Wars 2
# 2>NUL & powershell -nop -nol -ep bypass "gc -ra '%~f0'|iex" & EXIT /B
# ^ boilerplate to execute script from batch context
# Update this variable to where you have GW2 installed and named.
# This defaults to `C:\Program Files\`
[System.IO.FileInfo] $GW2_PATH = "$Env:ProgramFiles\Guild Wars 2\Gw2-64.exe"
# This line can be removed if you don't want to pass any arguments.
# It does not get used if you already have a
# `%APPDATA%\Guild Wars 2\Settings.json` file.
@Olian04
Olian04 / GW2.cmd
Last active July 5, 2020 20:31 — forked from Halkcyon/GW2.cmd
Automatically update ArcDps and BuildTemplates from deltaconnected for Guild Wars 2
::[CmdletBinding(SupportsShouldProcess)]
::# Update these values for wherever you have GW2 installed.
::# The arguments only get passed if you do not have a Settings.json file
::Param(
:: $Gw2Root = 'M:\Guild Wars 2',
:: $Gw2Exe = 'Gw2-64.exe',
:: $Gw2Arguments = @(
:: '-mapLoadinfo'
:: '-bmp'
:: '-fps','144'
@jlevy
jlevy / simple-hash.js
Last active May 11, 2024 21:19
Fast and simple insecure string hash for JavaScript
// These hashes are for algorithmic use cases, such as bucketing in hashtables, where security isn't
// needed and 32 or 64 bits is enough (that is, rare collisions are acceptable). These are way simpler
// than sha1 (and all its deps) or similar, and with a short, clean (base 36 alphanumeric) result.
// A simple, *insecure* 32-bit hash that's short, fast, and has no dependencies.
// Output is always 7 characters.
// Loosely based on the Java version; see
// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript
const simpleHash = str => {
let hash = 0;
@sindresorhus
sindresorhus / esm-package.md
Last active July 27, 2024 02:58
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.