Skip to content

Instantly share code, notes, and snippets.

View vladanyes's full-sized avatar
🏠
Working remotely

Vlad R vladanyes

🏠
Working remotely
  • Remote
View GitHub Profile
@vladanyes
vladanyes / createGraphPath.ts
Created March 5, 2023 10:37
react-native-skia/example/src/Examples/Graphs/createGraphPath.ts
import { Skia } from "@shopify/react-native-skia";
export const createGraphPath = (
width: number,
height: number,
steps: number,
round = true
) => {
const retVal = Skia.Path.Make();
let y = height / 2;
@vladanyes
vladanyes / radio.js
Created February 15, 2023 14:26
external-radio-file
(function(){
'use strict';
var player = {"id":"6f3c055","name":"Default","type":"classic","size":"large","stream":{"station ":"s307b15171","output":null,"streaming_url":"https:\/\/streaming.radio.co\/s307b15171"},"theme":{"width":400,"background_colour":"#efefef","text_colour":"#de000a","accent_colour":"#9f9f9f","rounded_corners":true,"track_information":true},"settings":{"autoplay":true,"artwork":true,"spotify":false,"popout":false},"embed_url":"https:\/\/embed.radio.co\/player\/6f3c055.html","social":{"twitter":true,"facebook_share":true,"embed":true,"template":"Chilled.io"}};
var i = document.createElement('iframe');
var style = "border: none;overflow:hidden;";
var width = player.theme.width;
i.src = player.embed_url;
i.width = '100%';
@vladanyes
vladanyes / helloWorld.js
Created February 15, 2023 14:20
helloWorld
console.log('Hello world');
@vladanyes
vladanyes / day_days.js
Last active April 13, 2022 21:41
js день дня дней
const lastDigitToWord = (digit) => {
const lastFigure = parseInt(digit.toString().substr(digit.toString().length - 1, 1));
if (digit >= 11 && digit < 15) {
return 'Дней';
}
else {
if (lastFigure == 1) return 'День';
if (lastFigure > 1 && lastFigure < 5) return 'Дня';
if (lastFigure == 0 || lastFigure >= 5) return 'Дней';
}
@vladanyes
vladanyes / react-comparison-algorithm.js
Created February 17, 2021 06:47
react-comparison-algorithm
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/**
@vladanyes
vladanyes / simple-redux.js
Created January 24, 2021 14:37
Simple Redux
const INC = 'increment';
const DEC = 'decrement';
const RES = 'reset';
const ADD = 'add';
function createStore(rootReducer, initialStore) {
let store = initialStore;
let subscribers = [];
@vladanyes
vladanyes / postman.js
Last active September 30, 2019 16:17
Postman autosaving token in "authToken" environment variable. Add this code to the "Tests" tab.
if (pm.response.code === 201) {
pm.environment.set('authToken', pm.response.json().token);
}
@vladanyes
vladanyes / call-stack.js
Created July 16, 2019 06:11
JavaScript print call stack
console.log(new Error().stack);
// example
function firstFunction() {
secondFunction();
}
function secondFunction() {
thridFunction();
}
function thridFunction() {
console.log(new Error().stack);
@vladanyes
vladanyes / stack-size.js
Last active July 16, 2019 01:59
JavaScript stack size check
// Each boolean and number variable takes 8 bytes of memory.
var counter = 0;
try {
function foo() {
counter += 1;
foo();
}
foo();
} catch(e) {
console.error(e);
@vladanyes
vladanyes / coordinates.js
Last active July 12, 2019 14:30
Draw a line between two points(-180/+180)
normalizeAngle = angle => {
let newAngle = angle;
if (newAngle <= -180) newAngle += 360;
if (newAngle > 180) newAngle -= 360;
return newAngle;
};
calculateAngle = point => {
return (Math.atan2(point.y - INITIAL_POINT.y, point.x - INITIAL_POINT.x) * 180 / Math.PI) + 90;
};