Skip to content

Instantly share code, notes, and snippets.

View maximkott's full-sized avatar
💭
☕️ + 🍕 + 🍺 = 1100 1010 0011

Maxim Kott maximkott

💭
☕️ + 🍕 + 🍺 = 1100 1010 0011
View GitHub Profile
@maximkott
maximkott / App.tsx
Last active February 20, 2020 12:24
import React, { FC } from "react"
import { ConfirmationDialogs, confirmDialog } from "./ConfirmationDialogs"
export type AppProps = {}
export const App: FC<AppProps> = (props) => {
const deleteWithConfirmation = async () => {
const confirmation = await confirmDialog({
title: () => "Are you sure?",
})
var IBAN_MASKS = {
'default': 'SSSS SSSS SSSS SSSS SSSS SSSS SSSS SSSS',
'AD': 'SSSS SSSS SSSS SSSS SSSS SSSS',
'AL': 'SSSS SSSS SSSS SSSS SSSS SSSS SSSS',
'AT': 'SSSS SSSS SSSS SSSS SSSS',
'BA': 'SSSS SSSS SSSS SSSS SSSS',
'BE': 'SSSS SSSS SSSS SSSS',
'BG': 'SSSS SSSS SSSS SSSS SSSS SS',
'CH': 'SSSS SSSS SSSS SSSS SSSS S',
'CY': 'SSSS SSSS SSSS SSSS SSSS SSSS SSSS',
@maximkott
maximkott / mask.js
Last active April 15, 2024 20:43
mask a string in javascript
export const maskString = (
value: any,
mask: string,
maskPatterns: Record<string, RegExp | ((char: string) => boolean)>
) => {
value = value || '';
mask = mask || '';
maskPatterns = maskPatterns || {};
let maskedValue = '';
#!/usr/bin/env bash
source "helpers"
SCRIPT_PATH=${0%/*}
SCRIPT_NAME=${0##*/}
# @help Parse given arguments and match them
# to local variables.
# @usage parse <args...>
parse() {
#!/usr/bin/env bash
# @help Write an error message and exit.
# @usage error <message>
error() {
local message=$1; shift;
printf "\e[01;31merror: $message\e[0m\n" >&2;
exit 1;
}
Verifying that +maximkott is my blockchain ID. https://onename.com/maximkott
@maximkott
maximkott / postMessage.js
Created December 7, 2015 11:05
postMessage test
$(function () {
console.log('init iframe');
var $btn = $('#btn');
var parent = window.parent;
$btn.on('click', function() {
parent.postMessage({from: 'iframe'}, '*');
});
@maximkott
maximkott / next_prev.sh
Created November 17, 2015 14:46
Moving back and forth between git commits.
function n() {
git log --reverse --pretty=%H master | grep -A 1 $(git rev-parse HEAD) | tail -n1 | xargs git checkout
}
function p() {
git checkout HEAD^1
}
@maximkott
maximkott / create_cert.sh
Last active August 26, 2015 08:28
Create an ssh certificate
sudo openssl genrsa -out example.key 2048
sudo openssl req -new -key example.key -out example.csr
# or
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout example.key -out example.crt
# https://www.digitalocean.com/community/tutorials/how-to-create-an-ssl-certificate-on-nginx-for-ubuntu-14-04
mysqldump -u __USERNAME__ -p __DATABASE__ > dump.sql
mysql -u __USERNAME__ -p __DATABASE__ < dump.sql