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
/* jshint esversion: 6 */ | |
var http = require('http'), | |
net = require('net'), | |
url = require('url'), | |
settings = { | |
port: 8081, | |
username: "username", | |
password: "password" | |
}; |
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 getOriginalFunction(functionName) { | |
var iframe = document.createElement('iframe'); // Создаем iframe | |
iframe.style.display = 'none'; // Делаем скрытым | |
document.body.appendChild(iframe); // Добавляем в body | |
var func = iframe.contentWindow[functionName]; // Получаем функцию | |
iframe.parentNode.removeChild(iframe); // Удаляем элемент | |
return func.bind(window); // привязываем контекст к текущему window и отдаем функцию | |
} |
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
vklink = /^(?:(?:https?\:\/\/)?(?:vk\.com\/)|\[)(.+?)(?:\|.+\]|$)/; // reg | |
console.log([ | |
"https://vk.com/flyink".match(vklink)[1], // flyink | |
"http://vk.com/flyink".match(vklink)[1], // flyink | |
"vk.com/flyink".match(vklink)[1], // flyink | |
"[id1|Павел Дуров]".match(vklink)[1], // id1 | |
"13123313".match(vklink) // null - не ссылка | |
]); // test |
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 genCircleShadow(r, items, limit){ | |
var shadow = []; | |
limit = (360 / items) * limit; | |
for(var a = 0; a < limit; a += (360 / items)){ | |
var ar = a / 180 * Math.PI, | |
x = ~~(Math.sin(ar) * r), | |
y = ~~(Math.cos(ar) * r), | |
c = "rgba(255,255,255," + (1 - a / limit).toFixed(2) + ")"; |
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
var VK = require('VK-Promise'), // Модуль для работы с ВК (npm i VK-Promise) | |
https = require('https'), | |
fs = require('fs'), | |
peer_id = 2e9 + 69, // Сюда ид диалога (2e9 = 2000000000 = Смещение для chat_id) | |
path = "./" + peer_id + "/", // Путь, куда сохранять | |
vk = VK("access_token"); // Токен | |
fs.mkdir(path, function (err, res) { // Создаем путь для диалога | |
if (err) return console.error("Ошибка создания пути", path, err); | |
console.log("Путь создан", path, res); |
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 declOfNum(number, titles) { | |
number = Math.abs(number); | |
return titles[(number % 100 > 4 && number % 100 < 20) ? 2 : [2, 0, 1, 1, 1, 2][(number % 10 < 5) ? number % 10 : 5]]; | |
} | |
Date.prototype.DiffString = [ | |
["секунду", "* секунды", "* секунд"], | |
["минуту", "* минуты", "* минут"], | |
["час", "* часа", "* часов"], | |
["день", "* дня", "* дней"], |
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 setTimeInterval(cb, time, interval) { | |
var x = new Date(); | |
time = (time || "").split(":"); | |
x.now = x.getTime(); | |
x.setHours(time[0] || 0); | |
x.setMinutes(time[1] || 0); | |
x.setSeconds(time[2] || 0); | |
if (x < x.now) x.setDate(x.getDate() + 1); | |
x -= x.now; | |
return setTimeout(setInterval, x % 864e5, cb, interval || 864e5); |
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
/** Скрываем флудилки, если надо тыкнут **/ | |
/** data-list-id - peer_id **/ | |
[data-list-id="2000000069"], [data-list-id="2000000159"], [data-list-id="2000000137"] { display: none; } | |
/** FLEX-BOX для списка диалогов **/ | |
#im_dialogs .ui_scroll_content{ | |
display: flex; | |
flex-direction: column; | |
} |
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
// ==UserScript== | |
// @name VK editor | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2 | |
// @description Пример скрипта изменяющего функции и запросы vk.com! | |
// @author Flyink13 | |
// @match https://vk.com/* | |
// @grant none | |
// ==/UserScript== |
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
// rgb2lab + deltaE | |
// https://github.com/antimatter15/rgb-lab/blob/master/color.js | |
function deltaRGB(a, b) { | |
return deltaE(rgb2lab(a), rgb2lab(b)); | |
} | |
function FloodFill(imageData, sx, sy, color, delta) { | |
var xy2i = (x, y) => (y * imageData.width + x) * 4; |
OlderNewer