This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create Promise | |
var promise = new Promise(function(fulfill, reject) { | |
if (/* condition */) { // for example, statusCode === 200 or something else, whatever | |
fulfill(/* success params */); | |
} else { | |
reject(/* fail params */); | |
} | |
}); | |
// work with Promise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>Filereader</title> | |
<style> | |
div { | |
font-family: "Helvetica Neue"; | |
line-height:22px; | |
font-size:15px; | |
margin:10px 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>Мой сайт</title> | |
<style> | |
p { | |
color: red; | |
} | |
</style> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//by Denys Pysmennyi | |
function perform() { | |
//TODO implement | |
} | |
perform(20, function(value) { | |
console.log(value) // 20 | |
var param = 1; | |
console.log(param); // 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Animal() { | |
} | |
Animal.prototype.drink = function() { | |
console.info('drink!'); | |
}; | |
function Cat(shortName, longName) { | |
this.longName = longName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import Location from 'Location' | |
import { | |
AppRegistry, | |
asset, | |
Pano, | |
View, | |
VrButton, | |
Model, | |
Sound, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder