Skip to content

Instantly share code, notes, and snippets.

⚫️
⚫️

Victor Mus sdwvit

⚫️
⚫️
  • Montréal, QC, Canada
Block or report user

Report or block sdwvit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sdwvit
sdwvit / cc.ts
Last active Nov 23, 2017
Holy clean code
View cc.ts
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 Apr 1, 2017
Spawn worker abstraction
View worker.example.js
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 Feb 25, 2017
Linkedin: delete connections one by one with confirmation
View gist:9ae1ce2cd463dc175e4fcdef05c28d84
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
Delete all branches on page github
View gist:493b61d6367cae8d0b12d52f19092652
$.map($('.branch-delete'), (val, i) => {return [val]}).forEach((el) => {el.click()})
You can’t perform that action at this time.