Skip to content

Instantly share code, notes, and snippets.

View sdwvit's full-sized avatar
🇬🇧
Dulwich, London

Victor Musienko sdwvit

🇬🇧
Dulwich, London
  • London, UK
View GitHub Profile
@sdwvit
sdwvit / cc.ts
Last active November 23, 2017 10:44
Holy clean code
static checkComment(comment: Comment): void {
function resetCompactMode() { // TODO: props mutation is bad
comment.compactMode = false;
}
const parent = comment.compactMode && comment.parent;
if (!parent) { return; }
if (parent.level === 1 || parent.children.length > 1) {
@sdwvit
sdwvit / worker.example.js
Created April 1, 2017 11:21
Spawn worker abstraction
function spawnWorker(func) {
const response = `self.onmessage = () => postMessage(
(${func.toString()})()
)`;
const blob = new Blob([response], {type: 'application/javascript'});
const worker = new Worker(URL.createObjectURL(blob));
worker.onmessage = function (e) {
const data = e.data;
@sdwvit
sdwvit / gist:9ae1ce2cd463dc175e4fcdef05c28d84
Last active February 25, 2017 09:41
Linkedin: delete connections one by one with confirmation
const keywords = ['recru', 'apply', 'looking for', 'hr', 'talent'];
const names = $('.mn-person-info__name');
const positions = $('.mn-person-info__occupation');
const dropdowns = $('.mn-connections__dropdown-trigger');
const deleteButtonSelector = () => $('.mn-connections__dropdown-option-btn');
const confirmButtonSelector = () => $('.remove-btn');
let connections = {};
for (let i = 0; i < names.length; i++) {
@sdwvit
sdwvit / gist:493b61d6367cae8d0b12d52f19092652
Last active May 16, 2016 20:25
Delete all branches on page github
$.map($('.branch-delete'), (val, i) => {return [val]}).forEach((el) => {el.click()})