Skip to content

Instantly share code, notes, and snippets.

View AnthonyPanchenko's full-sized avatar

Anton Panchenko AnthonyPanchenko

  • Ukraine
View GitHub Profile
@AnthonyPanchenko
AnthonyPanchenko / tsconfig.json
Created July 6, 2021 09:38 — forked from KRostyslav/tsconfig.json
tsconfig.json с комментариями.
// Файл "tsconfig.json":
// - устанавливает корневой каталог проекта TypeScript;
// - выполняет настройку параметров компиляции;
// - устанавливает файлы проекта.
// Присутствие файла "tsconfig.json" в папке указывает TypeScript, что это корневая папка проекта.
// Внутри "tsconfig.json" указываются настройки компилятора TypeScript и корневые файлы проекта.
// Программа компилятора "tsc" ищет файл "tsconfig.json" сначала в папке, где она расположена, затем поднимается выше и ищет в родительских папках согласно их вложенности друг в друга.
// Команда "tsc --project C:\path\to\my\project\folder" берет файл "tsconfig.json" из папки, расположенной по данному пути.
// Файл "tsconfig.json" может быть полностью пустым, тогда компилятор скомпилирует все файлы с настройками заданными по умолчанию.
// Опции компилятора, перечисленные в командной строке перезаписывают собой опции, заданные в файле "tsconfig.json".
@AnthonyPanchenko
AnthonyPanchenko / smooth-scroll.js
Created October 27, 2017 15:52 — forked from Anthodpnt/smooth-scroll.js
Misc - Smooth Scroll
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
*
* In episode #11 of "Gist for Javascript Beginners" I explained what was a Linear Interpolation.
* In this episode I'll show you another case it's really usefull.
*
* It's a trend since a few months to add smooth scroll to websites because the look-and-feel is
* better than the basic scroll of the browser. But how do you do this kind of effect ? Thanks
@AnthonyPanchenko
AnthonyPanchenko / request-animation-frame.js
Created October 27, 2017 15:52 — forked from Anthodpnt/request-animation-frame.js
Performance - Request Animation Frame
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
*
* You sometimes need to run some code multiples times, on window scroll, on window resize
* or simply every n milliseconds. But what if you want you code to run 60 times per seconds ?
* You could defenitely use a `setTimeout` and even if it's not the best solution
* it would work but! there is a much easier solution, `requestAnimationFrame` (rAF).
*
@AnthonyPanchenko
AnthonyPanchenko / normalization.js
Created October 27, 2017 15:51 — forked from Anthodpnt/normalization.js
Math - Normalization
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
*
* It's very common in Javascript to normalize numbers. Normalization means that you are taking a number from a range
* and return a value from 0 to 1 corresponding to the position of this number within this range.
*
* If the number is equal to the minimum value of the range, the normal value is 0.
* If the number is equal to the maximum value of the range, the normal value is 1.
@AnthonyPanchenko
AnthonyPanchenko / lerp.js
Created October 27, 2017 15:48 — forked from Anthodpnt/lerp.js
Math - Linear Interpolation
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <[email protected]>
* @site: https://www.twitter.com/JsGists
*
* Linear Interpolation is a method to add some natural behaviors to your animations. The more natural
* your animations look like, the better will be the look-and-feel. But what's Linear Interpolation ?
*
* Linear Interpolation, also called `lerp`, is a way of easing your animation. Imagine you want to
* move a box from a position A to a position B. Without the Linear Interpolation, you box will
@AnthonyPanchenko
AnthonyPanchenko / fire3d.js
Created June 27, 2017 08:31 — forked from bowheart/fire3d.js
A 3d fire shader
var fragmentShader = `
#define PI 3.1415926535897932384626433832795
uniform float u_time;
uniform vec2 u_res;
float range01(float num) {
return .5 + .5 * sin(num);
}
float getRed(vec2 xy) {
@AnthonyPanchenko
AnthonyPanchenko / recursiveRemoveFiles.js
Created June 15, 2017 07:51 — forked from liangzan/recursiveRemoveFiles.js
A Node.js script to remove all files in a directory recursively
var fs = require('fs')
, path = require('path')
, _ = require('underscore');
var rootPath = "/path/to/remove";
removeDirForce(rootPath);
// path should have trailing slash
function removeDirForce(dirPath) {
fs.readdir(dirPath, function(err, files) {

Почему Mocha, а не Jasmine?

Ниже будут приведены аргументы в пользу выбора Mocha

  • Высокая популярность:
    — 2m против 400 k загузок в месяц

  • Высокая активность:
    — 1 890 против 1400 коммитов (всего)
    — 171 против 101 коммитов (последний год)

@AnthonyPanchenko
AnthonyPanchenko / nodejs-recursive-directory.js
Created January 4, 2016 12:05 — forked from ashblue/nodejs-recursive-directory.js
NodeJS recursive directory listing without a module package
/**
* Goes through the given directory to return all files and folders recursively
* @author Ash Blue [email protected]
* @example getFilesRecursive('./folder/sub-folder');
* @requires Must include the file system module native to NodeJS, ex. var fs = require('fs');
* @param {string} folder Folder location to search through
* @returns {object} Nested tree of the found files
*/
// var fs = require('fs');
function getFilesRecursive (folder) {