Skip to content

Instantly share code, notes, and snippets.

View zmnv's full-sized avatar
🔮
Creative Developer

zmnv zmnv

🔮
Creative Developer
View GitHub Profile
@zmnv
zmnv / tzblg.blog.ts
Created April 23, 2022 12:44
Tezos Blog Smart Contract
// You can use https://smartpy.io/ts-ide to originate or tests.
/**
* Tzblg Object (Child Contract).
* Used as microblog platform to store and moderate any TBytes data.
* Demo: https://tzblg.xyz/c/KT1X7PGL7gRwj4F3zx4S6DXKDEeTAJ6D47FM
*/
export type PermissionsType = {
can_anyone_be_author: TBool;
@zmnv
zmnv / generator.py
Created April 20, 2021 20:54
Blender generator
import bpy
from random import random as rnd
# Clean scene:
objs = bpy.data.objects
for e in objs:
objs.remove(e, do_unlink=True)
spacing = 34
offset = 160
@zmnv
zmnv / IOSWifiManager.h
Created March 26, 2020 14:11 — forked from douglasjunior/IOSWifiManager.h
Programatically join Wi-Fi network on iOS with React Native wrapper for NEHotspotConfiguration
// Created by Rutger Bresjer on 10/10/2017
// Notes:
// - Be sure to enable "Hotspot Configuration" capability for the iOS target
// - Make sure the NetworkExtension framework is linked to the target
#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
@interface IOSWifiManager : NSObject <RCTBridgeModule>
@zmnv
zmnv / Component.jsx
Last active December 2, 2019 11:57
RN i18next example with false warning
import React, { PureComponent } from 'react';
import { View } from 'react-native';
import { connect } from 'react-redux';
import i18n from '@app/i18n';
// or import withTranslation('calibration')(Component);
import { ButtonBottom } from '@app/theme/components/Button';
@zmnv
zmnv / crudController.ts
Created November 4, 2019 13:41
Generate controller classes by model
import { Request, Response, NextFunction } from 'express';
export type ExpressMethodType = (req: Request, res: Response, next?: NextFunction) => void;
export interface CrudControllerInterface {
addNew?: ExpressMethodType;
get?: ExpressMethodType;
getById?: ExpressMethodType;
update?: ExpressMethodType;
delete?: ExpressMethodType;
@zmnv
zmnv / rgbaToHex.js
Created October 28, 2019 16:40
Continuous RGBA to HEXA converter
const readline = require('readline');
function colorToHex(rgb) {
let hex = Number(rgb).toString(16);
if (hex.length < 2) {
hex = `0${hex}`;
}
return hex;
};
/**
* Преобразовать `#FF0000` -> `rgba(255, 0, 0, 1)`
* https://stackoverflow.com/a/28056903
*
* @param {string} hex
* @param {number} alpha
*/
export function hexToRGB(hex, alpha) {
const r = parseInt(hex.slice(1, 3), 16);
const g = parseInt(hex.slice(3, 5), 16);
@zmnv
zmnv / eventloop.js
Created July 2, 2019 04:54
проверка себя
/* eslint-disable */
console.log('start');
setTimeout(() => {
console.log('global setTimeout 0');
}, 0);
let i = 0;
Promise.resolve()
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
@zmnv
zmnv / ng-paste-event-liseners.ts
Created March 3, 2019 11:38
Paste events listener Angular 6
@HostListener('document:keydown', ['$event']) handleKeyboardEvent(event: KeyboardEvent) {
if ((event.ctrlKey || event.metaKey) && event.keyCode === 86) {
console.log('CTRL + V', event);
}
}
@HostListener('paste', ['$event']) onPaste(e: any) {
const items = e.clipboardData.items;
let blob = null;