Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander K. J. Schmidt Bloggerschmidt

View GitHub Profile
@Bloggerschmidt
Bloggerschmidt / erc20-token-as-coin-example.sol
Last active January 21, 2023 08:34
Ethereum ERC20 Smart Contract - Beispiel eines Token, der als eigener Coin funktioniert
View erc20-token-as-coin-example.sol
// Dieser Smart Contract erstellt einen Token mit dem Namen "My Token",
// dem Symbol "MYT" und 18 Dezimalstellen. Die Gesamtmenge des Token
// wird auf 100000000 festgelegt und der Besitzer des Smart Contracts
// wird automatisch als Besitzer des Token gesetzt.
// Der Smart Contract enthält auch die Funktionen "transfer", "approve"
// und "transferFrom", die es ermöglichen, Token an andere Adressen zu
// senden, die Übertragung von Token zu genehmigen und Token von einer
// Adresse auf eine andere zu übertragen.
@Bloggerschmidt
Bloggerschmidt / html-js-notification.html
Created October 13, 2022 08:39
HTML JavaScript Notification
View html-js-notification.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notification Test</title>
</head>
<body>
<button id="btn">Test</button>
View one-million-passwords-list.txt
This file has been truncated, but you can view the full file.
123456
password
12345678
qwerty
123456789
12345
1234
111111
1234567
dragon
@Bloggerschmidt
Bloggerschmidt / languages.sql
Created May 15, 2021 13:57
SQL dump of common languages of the world
View languages.sql
CREATE TABLE `common_languages` (
`id` int(11) NOT NULL,
`language_code` varchar(10) NOT NULL,
`language_name` varchar(100) NOT NULL,
`status` varchar(255) NOT NULL DEFAULT 'draft'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `common_languages` (`id`, `language_code`, `language_name`, `status`) VALUES
(1, 'af', 'Afrikaans', ''),
@Bloggerschmidt
Bloggerschmidt / continents.sql
Created May 13, 2021 08:30
SQL insert of continents incl. short codes
View continents.sql
CREATE TABLE `common_continents` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` char(2) NOT NULL DEFAULT '',
`name` varchar(30) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into common_continents (code,name) values ('AF','Africa');
insert into common_continents (code,name) values ('AN','Antarctica');
insert into common_continents (code,name) values ('AS','Asien');
@Bloggerschmidt
Bloggerschmidt / ch-kantone.sql
Last active May 13, 2021 08:17
SQL insert of swiss states aka Kantone incl. short codes
View ch-kantone.sql
CREATE TABLE `common_ch_kantone` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` char(2) NOT NULL DEFAULT '',
`name` varchar(30) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into common_ch_kantone (code,name) values ('AG','Aargau');
insert into common_ch_kantone (code,name) values ('AR','Appenzell Ausserrhoden');
insert into common_ch_kantone (code,name) values ('AI','Appenzell Innerrhoden');
@Bloggerschmidt
Bloggerschmidt / us-states.sql
Created May 13, 2021 08:09
SQL insert of us states incl. short codes
View us-states.sql
CREATE TABLE `common_us_states` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` char(2) NOT NULL DEFAULT '',
`name` varchar(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into common_us_states (code,name) values ('AL','Alabama');
insert into common_us_states (code,name) values ('AK','Alaska');
insert into common_us_states (code,name) values ('AS','American Samoa');
@Bloggerschmidt
Bloggerschmidt / de-bundeslaender.sql
Created May 13, 2021 08:07
SQL insert of german states aka Bundesländer incl. short codes
View de-bundeslaender.sql
CREATE TABLE `common_de_bundeslaender` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` char(2) NOT NULL DEFAULT '',
`name` varchar(30) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into common_de_bundeslaender (code,name) values ('BW','Baden-Württemberg');
insert into common_de_bundeslaender (code,name) values ('BY','Bayern');
insert into common_de_bundeslaender (code,name) values ('BE','Berlin');
@Bloggerschmidt
Bloggerschmidt / useDarkMode.js
Created April 14, 2021 14:49
custom react hook - get system prefered theme and use it
View useDarkMode.js
const matchDark = '(prefers-color-scheme: dark)'
function useDarkMode() {
const [isDark, setIsDark] = React.useState(
() => window.matchMedia && window.matchMedia(matchDark).matches
)
React.useEffect(() => {
const matcher = window.matchMedia(matchDark)
const onChange = ({ matches }) => setIsDark(matches)
@Bloggerschmidt
Bloggerschmidt / useClickOutside.js
Created April 14, 2021 14:42
custom react hook - when clicking outside of an element -> do something
View useClickOutside.js
function useClickOutside(elRef, callback) {
const callbackRef = React.useRef()
callbackRef.current = callback
React.useEffect(() => {
const handleClickOutside = e => {
if (elRef?.current?.contains(e.target) && callbackRef.current) {
callbackRef.current(e)
}