Skip to content

Instantly share code, notes, and snippets.

@Dimitreee
Dimitreee / _README.md
Created November 18, 2017 17:59 — forked from remy/_README.md
requestAnimationFrame helper

raf.js

A simple script with a few niceties that allows for multiple requestAnimationFrame calls, and FPS pinning.

How it works

The script polyfills rAF if required, then overloads requestAnimationFrame and cancelAnimationFrame with a process that allows multiple frames to be queued up for rAF to run.

This is useful if there are multiple animations running on the page, you want all the callbacks to happen at once, and not on multiple rAF calls. This script is meant as a drop-in solution to that problem.

@Dimitreee
Dimitreee / Vector.js
Created November 19, 2017 09:57 — forked from jjgrainger/Vector.js
A simple Vector class in javascript
var Vector = function(x, y) {
this.x = x || 0;
this.y = y || 0;
};
// return the angle of the vector in radians
Vector.prototype.getDirection = function() {
return Math.atan2(this.y, this.x);
};
// простая чистая функция, которая возвращает сумму аргумента и 10
const add = (n) => (n + 10);
console.log('Simple call', add(3));
// простая функция, принимающая другую функцию и
// возвращающая её же, но с мемоизацией
const memoize = (fn) => {
let cache = {};
return (...args) => {
let n = args[0]; // тут работаем с единственным аргументом
if (n in cache) {
@Dimitreee
Dimitreee / gist:4e0050ceebcadb12119d234b957662dc
Created March 29, 2018 08:17 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
var path = require('path');
module.exports = {
entry: path.resolve(__dirname, 'src') + '/app/index.js',
output: {
path: path.resolve(__dirname, 'dist') + '/app',
filename: 'bundle.js',
publicPath: '/app/'
},
# Make ls use colors
export CLICOLOR=1
alias grep='grep --color=auto'
# Set default editor
EDITOR=nano
# Configure command line colors
export CLICOLOR=1
alias ls='ls -GFh'
|[1] - 1)mobile: imageCropView +
| - 2)back: Api - normalize +
min | - 3)front: Image preprocessing (crop & fill) -> Image Size Restore -> API wrapper +
|
|[2] - 1)mobile: imagePreprocessing -> API wrapper +
| - 2)back: find local segment -> recognize segment data -> parse recognized data -> fill user profile +
/*___________________________________________________________*/
| - 3)front: shape recognition (Reasearch) *1 ...pending
@Dimitreee
Dimitreee / LocalStorage.ts
Created May 17, 2018 13:45 — forked from picode7/ LocalStorage.ts
LocalStorage TypeScript Module
/**
* Check if localStorage is supported const isSupported: boolean
* Check if localStorage has an Item function hasItem(key: string): boolean
* Get the amount of space left in localStorage function getRemainingSpace(): number
* Get the maximum amount of space in localStorage function getMaximumSpace(): number
* Get the used space in localStorage function getUsedSpace(): number
* Get the used space of an item in localStorage function getItemUsedSpace(): number
* Backup Assosiative Array interface Backup
* Get a Backup of localStorage function getBackup(): Backup
* Apply a Backup to localStorage function applyBackup(backup: Backup, fClear: boolean = true, fOverwriteExisting: boolean = true)
@Dimitreee
Dimitreee / git-tag-delete-local-and-remote.sh
Created September 20, 2018 11:13 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master