Use this regular expression to match BEM class-names:
^\.[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$
require('crypto').randomBytes(48, function(err, buffer) { var token = buffer.toString('hex'); console.log(token); }); |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Title</title> | |
<link href="stylesheets/main.css" rel="stylesheet" /> | |
</head> | |
<body> | |
<header> | |
<hgroup> |
package main | |
import ( | |
"fmt" | |
"os" | |
"runtime" | |
"testing" | |
) | |
func TestMain(m *testing.M) { |
const TELEGRAM_BOT_TOKEN = '110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw'; // https://core.telegram.org/bots#creating-a-new-bot | |
export const verifyTelegramWebAppData = async (telegramInitData: string): boolean => { | |
// The data is a query string, which is composed of a series of field-value pairs. | |
const encoded = decodeURIComponent(telegramInitData); | |
// HMAC-SHA-256 signature of the bot's token with the constant string WebAppData used as a key. | |
const secret = crypto |
import Dashboard from 'pages/Dashboard' | |
import Layout from 'components/Layout' | |
import Login from 'pages/Login' | |
import React from 'react' | |
import { useRoutes, Navigate, useLocation } from 'react-router-dom' | |
import { useAuth, userContext } from 'hooks/useAuth' | |
function App() { | |
const storedToken = localStorage.getItem('token') | |
const location = useLocation() |
This is a short and simple guide on how to set up a multiplayer server running the latest version of Minecraft.
This guide has been tested on Ubuntu 16.04 and 18.04.
Create a new Ubuntu droplet on DigitalOcean. Make sure it has at least 2GB of RAM, and you provide it with your SSH key.
import { Client, ServiceError, Metadata, CallOptions, ClientUnaryCall } from '@grpc/grpc-js'; | |
import { Message } from 'google-protobuf'; | |
type OriginalCall<T, U> = (request: T, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError, res: U) => void) => ClientUnaryCall; | |
type PromisifiedCall<T, U> = ((request: T, metadata?: Metadata, options?: Partial<CallOptions>) => Promise<U>); | |
export type Promisified<C> = { $: C; } & { | |
[prop in Exclude<keyof C, keyof Client>]: (C[prop] extends OriginalCall<infer T, infer U> ? PromisifiedCall<T, U> : never); | |
} |
import { isSameMonth, startOfMonth } from 'date-fns' | |
export const generateCalendar = ( | |
firstDateOfMonth: Date | |
): number[][] => { | |
const date = startOfMonth(firstDateOfMonth) | |
const getDay = (date: Date) => { | |
let day = date.getDay() | |
if (day === 0) day = 7 |
#include<iostream> | |
int main() { | |
char c; | |
// Set the terminal to raw mode | |
while(1) { | |
system("stty raw"); | |
c = getchar(); | |
// terminate when "." is pressed | |
system("stty cooked"); |