Skip to content

Instantly share code, notes, and snippets.

View vvscode's full-sized avatar
⌨️
Here is Rhodes, jump here!

Vasiliy Vanchuk vvscode

⌨️
Here is Rhodes, jump here!
View GitHub Profile
@vvscode
vvscode / EventEmitter.js
Created September 4, 2024 11:39
EventEmitter.js
export class EventEmitter {
listeners = new Map();
on(eventName, cb) {
if (!this.listeners.has(eventName)) {
this.listeners.set(eventName, new Set([]));
}
this.listeners.get(eventName)?.add(cb);
}
@vvscode
vvscode / pref.html
Last active July 16, 2024 15:34
pref.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<a href="App-Prefs:General">App-Prefs:General</a>
@vvscode
vvscode / dropbox-php-auth.md
Created June 30, 2022 05:41 — forked from phuze/dropbox-php-auth.md
Dropbox API V2: PHP Authentication Process

Effective September 2021, Dropbox will be deprecating long-lived access tokens.

This GIST generally describes how to authenticate requests to Dropbox API v2, for anyone working on a server-side PHP Dropbox implementation.

It's important to understand three types of codes you'll encounter:

  1. Access Code - this is a one-time code that represents user-granted app access.
  2. Access Token - this is short-lived token that provides access to Dropbox API endpoints.
  3. Refresh Token - this is a long-lived token that allows you to fetch a fresh Access Token.

How to Download iOS Simulator (Xcode) in Command Line and Install it

For faster connection speed and more flexibility.

Steps

  1. Start Xcode in command line by running this in commandline /Applications/Xcode.app/Contents/MacOS/Xcode
  2. Start downloading of the simulator
  3. Cancel it. YES CANCEL IT!
  4. You will get a message like this:
@vvscode
vvscode / GoL in js.md
Last active October 4, 2020 14:43
# Заметки по операциям, для реализации игры "Жизнь"

Заметки по операциям, для реализации игры "Жизнь"

Работа с массивами

Создать массив

const arr1 = [];
const arr2 = [1, 2, 3];
@vvscode
vvscode / apply.test.js
Created February 28, 2020 13:34
apply tests for otus
alert(1);
@vvscode
vvscode / sum.test.js
Created February 24, 2020 13:28
Sum tests
describe("sum", function() {
it("функция", function() {
assert.isOk(typeof sum === "function");
});
it("по-умолчанию инициализируется нулем", function() {
assert.isOk(+sum() === 0);
});
it("инициализируется числом", function() {
assert.isOk(+sum(5) === 5);
});
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "posts_tags" (
"post_id" INTEGER,
"tag_id" INTEGER,
FOREIGN KEY("post_id") REFERENCES "posts"("id"),
FOREIGN KEY("tag_id") REFERENCES "tags"("id")
);
CREATE TABLE IF NOT EXISTS "posts" (
"id" INTEGER NOT NULL,
"title" VARCHAR(100),
@vvscode
vvscode / commit-message.js
Created January 17, 2020 06:44
commit-message.js
/**
* It takes commit message and append a branch name below
*/
const fs = require('fs');
const childProcess = require('child_process');
const commitMessageFile = process.argv[2];
/**
@vvscode
vvscode / otus_python_web_hometask_1.md
Created December 1, 2019 16:14 — forked from grepto/otus_python_web_hometask_1.md
OTUS - Web-разработчик на Python Задачи из чата первого занятия

Выведите все элементы, которые меньше 5.

l = [1, 2, 3, 4, 5, 6, 7]

result = [i for i in l if i < 5]

print(result)