Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Shuvalov Anton A

💭
I may be slow to respond.
View GitHub Profile
@A
A / gh-delete-repo.js
Created Oct 13, 2019
Just a js snippet to automagically remove opened repository
View gh-delete-repo.js
const sleep = (t) => new Promise((resolve, reject) => {
setTimeout(resolve, t);
});
(async () => {
$('a[data-selected-links*=key_links_settings]').click();
await sleep(3000);
document.querySelectorAll('summary.btn-danger')[2].click();
await sleep(3000);
const name = document.querySelectorAll('.Box-body.overflow-auto p strong')[2].textContent;
View time.js
const toMs = (h, m) => {
let ms = 0;
ms += h * 60 * 60 * 1000;
ms += m * 60 * 1000;
return ms;
}
export const isInTimeRange = (from, to, date = new Date()) => {
const d = toMs(date.getUTCHours(), date.getUTCMinutes());
const start = toMs(from.hours, from.mins);
View indexof.js
const nonUniqueArr = [1,2,3,4,5,4,3,5,6];
const indexOfUnique = (arr) => arr
.filter((item, index, a) => a.indexOf(item) === index);
const newSetUnique = (arr) => [...new Set(arr)];
const fromUnique = (arr) => Array.from(new Set(arr));
const seenUnique = (arr) => {
View lsmod
Module Size Used by
btusb 36864 0
btrtl 16384 1 btusb
btbcm 16384 1 btusb
btintel 16384 1 btusb
bluetooth 323584 5 btbcm,btrtl,btusb,btintel
binfmt_misc 16384 1
mwifiex_usb 20480 0
mwifiex 196608 1 mwifiex_usb
cfg80211 348160 1 mwifiex
View index.js
var http = require('http'),
express = require('express'),
httpProxy = require('http-proxy'),
url = require('url');
var selects = [];
var simpleselect = {};
simpleselect.query = 'body';
View loop.js
var i = 0;
while (true) {
if ((i <= 9) === false) break;
console.log(i);
i = i + 1;
}
// put your evil code to break the loop here:
// …
View require.js
javascript:(function(){var body=document.getElementsByTagName('body')[0];var script=document.createElement('script');script.type='text/javascript';script.src='https://s3.amazonaws.com/s3.mathisonian.com/javascripts/requirify-browser.js';body.appendChild(script);})();
View input-debounce-test.js
new Test('Hello World', 200); // try to change offset
function Test(str, offset) {
var i = 0;
var $search = $('.sel-search-input');
$search.val('').focus();
(function next() {
setTimeout(function() {
if (i >= str.length) return;
@A
A / fuck_you_books.ru.js
Created Sep 19, 2015
Just script to download all my purchases.
View fuck_you_books.ru.js
$('a.pdf').each(function(_,i) {
var i = $('<iframe />')
.attr('src', i.href)
.load(function () {
i.contents().find('[name="agreed"]').click();
i.contents().find('[type="submit"]').click();
})
.appendTo('body')
;
});
View react-select.js
return !filterValue || this.props.matchPos === 'start'
? this.props.matchProp !== 'label'
&& valueTest.toLowerCase().substr(0, filterValue.length) === filterValue || this.props.matchProp !== 'value'
&& labelTest.toLowerCase().substr(0, filterValue.length) === filterValue
: this.props.matchProp !== 'label' && valueTest.toLowerCase().indexOf(filterValue.toLowerCase()) >= 0
|| this.props.matchProp !== 'value' && labelTest.toLowerCase().indexOf(filterValue.toLowerCase()) >= 0;