Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View SuhairZain's full-sized avatar

Suhair Zain SuhairZain

View GitHub Profile
const fs = require('fs');
const path = require('path');
const execSync = require('child_process').execSync;
const regex = /^(import PropTypes from 'prop-types';)\n(\/\/ \(C\) Copyright.*)\n\n(import React(?:.*) from 'react';)([\s\S]*)$/;
const processDirectory = (dir) => {
fs.readdirSync(dir).forEach((file) => {
if (fs.lstatSync(path.join(dir, file)).isDirectory()) {
// The input, an arbitrarily nested array
const input = [
[1, 2, 3],
[4, 5, 6, [7, 8, [9, [10]]]]
];
/**
* Recursive function to be called on arrays
* @param array The input array
*/
@SuhairZain
SuhairZain / designer.html
Last active January 1, 2017 06:03
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#design_host {
position: absolute;
width: 100%;
height: 100%;
@SuhairZain
SuhairZain / twitter_mass_unfollow
Last active October 16, 2016 10:22
I granted Twitter permission to some app which automatically followed random people and I wanted to unfollow all of them at once.
First of all, to prevent something like this happening again, review the apps you have permitted at https://twitter.com/settings/applications and remove the ones you suspect.
Login and open your following page at https://twitter.com/USERNAME/following and scroll down until you reach the people you actually followed.
Open Developer Console (Web Console in Firefox - Ctrl + Shift + K) or (Developer Tools in Chrome - Ctrl + Shift + J).
Paste the following line of code and press enter. It finds the buttons (both follow and unfollow) and clicks them one by one. Note that your browser may show an unresponsive script dialog. Choose continue.
Array.from(document.getElementsByClassName("user-actions-follow-button js-follow-btn follow-button btn small small-follow-btn")).forEach((button) => {button.click()})