Skip to content

Instantly share code, notes, and snippets.

Avatar

Kirill Gusyatin kikill95

View GitHub Profile
@kikill95
kikill95 / index.html
Last active Oct 13, 2020
LevelUp:coding - sample file for intro
View index.html
<!doctype html>
<html lang="en">
<head>
<title>Мой сайт</title>
<style>
p {
color: red;
}
</style>
</head>
@kikill95
kikill95 / capture.html
Created Jun 12, 2018
Capture thumbnail on client side and prepare file to upload
View capture.html
<!DOCTYPE html>
<head>
<script type='text/javascript'>
window.onload = function () {
var video = document.getElementById('videoId')
var canvas = document.getElementById('canvasId')
canvas.style.display = 'block'
// fake loading
setTimeout(() => {
// start when video loaded
@kikill95
kikill95 / timer.js
Last active Oct 17, 2019
This is a module (short version) for gathering timers
View timer.js
// full version (with functions for cluster) can be found here:
// https://github.com/kikill95/profiler-demo/blob/master/timer.js
/*
** Example of usage (more samples there - https://github.com/kikill95/profiler-demo)
...
timer.time('metrics', 'wrapper')
...
timer.timeEnd('metrics', 'wrapper')
@kikill95
kikill95 / ExcelToJsDate.js
Last active Apr 25, 2018 — forked from christopherscott/ExcelToJsDate.js
Convert Excel date values to JavaScript date objects
View ExcelToJsDate.js
// Convert Excel dates into JS date objects
//
// @param excelDate {Number}
// @return {Date}
function getJsDateFromExcel(excelDate) {
// JavaScript dates can be constructed by passing milliseconds
// since the Unix epoch (January 1, 1970) example: new Date(12312512312);
@kikill95
kikill95 / index.html
Created Apr 17, 2018
Detect file mime type using magic numbers and JavaScript
View index.html
<!doctype html>
<html lang="en">
<head>
<title>Filereader</title>
<style>
div {
font-family: "Helvetica Neue";
line-height:22px;
font-size:15px;
margin:10px 0;
@kikill95
kikill95 / index.vr.js
Last active Dec 3, 2017
Example of ReactVR usage
View index.vr.js
import React from 'react'
import Location from 'Location'
import {
AppRegistry,
asset,
Pano,
View,
VrButton,
Model,
Sound,
@kikill95
kikill95 / client.js
Created Dec 3, 2017
Example of simple-raycaster usage
View client.js
import {VRInstance} from 'react-vr-web'
import * as SimpleRaycaster from 'simple-raycaster'
function init (bundle, parent, options) {
const vr = new VRInstance(bundle, 'gdg_reactvr', parent, {
raycasters: [
SimpleRaycaster // Add SimpleRaycaster to the options
],
cursorVisibility: 'visible', // Add cursorVisibility
...options
@kikill95
kikill95 / easy_coding.js
Last active Jul 6, 2017
Implement the following functions
View easy_coding.js
1. // isPrime - Returns true or false, indicating whether the given number is prime.
isPrime(0) // false
isPrime(1) // false
isPrime(17) // true
isPrime(10000000000000) // false
2. // factorial - Returns a number that is the factorial of the given number.
factorial(0) // 1
factorial(1) // 1
factorial(6) // 720
View webpack.config.js
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const path = require('path')
const sourcePath = path.resolve(__dirname, 'public')
const isProduction = process.env.NODE_ENV === 'production'
const stats = {
assets: true,
@kikill95
kikill95 / index.jses6
Last active Apr 5, 2017
js modules, do you understand following:
View index.jses6
// imports es6
import defaultMember from "module-name";
import * as name from "module-name";
import { member } from "module-name";
import { member as alias } from "module-name";
import { member1 , member2 } from "module-name";
import { member1 , member2 as alias2 } from "module-name";
import defaultMember from "module-name";
import defaultMember, * as name from "module-name";
import "module-name";