Skip to content

Instantly share code, notes, and snippets.

View ljanecek's full-sized avatar

Ladislav Janeček ljanecek

View GitHub Profile
@ljanecek
ljanecek / typography.js
Created July 18, 2021 08:54
Typography
const Typography = (str) => {
const quotes = {
singleQuotes: ["\u{201A}", "\u{2018}"],
doubleQuotes: ["\u{201E}", "\u{201C}"],
};
const pattern = 'A-Za-z\\x\{C0\}-\\x\{2FF\}\\x\{370\}-\\x\{1EFF\}';
var patterns = [{
<html>
<head>
<title>Test</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Koulen&family=Lato&family=Nunito&family=Playfair+Display:ital@1&family=Prata&family=Raleway:ital,wght@1,100&family=Roboto&family=Roboto+Condensed&family=Teko&display=swap');
.btn {
font-family: Roboto, sans-serif;
font-weight: 600;
@ljanecek
ljanecek / wifi_ndef_record.dart
Created May 13, 2024 13:00
Flutter Dart NFC Wifi Record Type
import 'dart:typed_data';
import 'package:ndef/ndef.dart' as ndef;
class WifiNdefRecord {
static ndef.NDEFRecord createWifiRecord(String ssid, String password) {
Uint8List ssidByte = Uint8List.fromList(ssid.codeUnits);
Uint8List passwordByte = Uint8List.fromList(password.codeUnits);
Uint8List ssidLength = Uint8List.fromList([(ssid.length >> 8) & 0xFF, ssid.length & 0xFF]);
Uint8List passwordLength = Uint8List.fromList([(password.length >> 8) & 0xFF, password.length & 0xFF]);
import http from "http";
import express from "express";
import { Server } from "socket.io";
const app = express();
const server = http.createServer(app);
// ---- nastavení ----
const MAX_SOCKET_AGE_MS = Number(process.env.MAX_SOCKET_AGE_MS ?? 10 * 60_000); // např. 10 min
const DRAIN_TIMEOUT_MS = Number(process.env.DRAIN_TIMEOUT_MS ?? 30_000); // např. 30 s