Skip to content

Instantly share code, notes, and snippets.

View scarlac's full-sized avatar

Seph Soliman scarlac

View GitHub Profile
#!/usr/bin/env node
var path = require('path'),
fs = require('fs'),
sys = require('util'),
os = require('os'),
exec = require('child_process').exec,
child,
mkdirp;

Keybase proof

I hereby claim:

  • I am scarlac on github.
  • I am scarlac (https://keybase.io/scarlac) on keybase.
  • I have a public key ASA1YXEj0Dqd_4QlPt5BVll7v-5FmQQ2kxSeA-XPVzBmzAo

To claim this, I am signing this object:

@scarlac
scarlac / FourSquareAPI.md
Last active December 23, 2016 11:02
FourSquare undocumented API

FourSquare is using API calls that are currently undocumented, yet seem quite interesting if you're integrating with it. Specifically, Documentation on oking a venue has been left out. Like, dislike and their undo counterparts are documented.

Here are the calls needed to rate a FourSquare venue:

Like Venue

Endpoint: https://developer.foursquare.com/docs/venues/like

| Param | Type | Description |

@scarlac
scarlac / asyncawaitvspromises.js
Last active November 23, 2017 20:56
Async/await transpiled by hand to Promises
function add(a, b) {
return new Promise((resolve, reject) => {
resolve(a + b);
});
} // return promise
function multiply(x, y) {
return new Promise((resolve, reject) => {
resolve(x * y);
});
@scarlac
scarlac / prototype-vs-arrowfn.js
Last active December 2, 2017 11:19
Benchmark comparison of 'clever' prototype trick vs arrow function call
const arr = [
'Duis',
' felis ',
' ex ',
'finibus',
' vitae ',
' tempus ',
' ut ',
'commodo',
' nec ',
@scarlac
scarlac / scandinavian-name-generator.js
Created February 9, 2018 21:53
"It seems like you could randomly generate Danish names using the formula of five letters, double consenant and an e at the end." - Challenge accepted.
const all = 'abcdefghijklmnopqrstuvwxyzæøå';
const consonants = 'bcdfghjklmnpqrstvwxz';
function randomLetter() {
return all[parseInt(Math.random() * all.length)];
}
function randomConsonant() {
return consonants[parseInt(Math.random() * consonants.length)];
}
@scarlac
scarlac / gist:777c070912e9fe90f1330d493591360f
Created March 25, 2018 21:31
Test of Slack link og:title escaping feature, tag here: <Slack>
Test of Slack link og:title escaping feature, tag here: <Slack>
@scarlac
scarlac / purge_advertisers.md
Last active June 7, 2021 09:36
Facebook Hack: Purge list of "Advertisers you've interacted with"

For those of you who want to remove all in “Advertisers and Businesses” / "Who uploaded a list with your info and advertised to it":

  1. Go to https://www.facebook.com/ads/preferences/?entry_product=ad_settings_screen and open the section "Advertisers you've interacted with"
  2. Collapse all sections but keep "Advertisers and Businesses" open
  3. Open Web Inspector
  4. Copy-paste this script to load all advertisers: smt=setInterval(() => {let x=document.querySelector('div[shade=medium]'); x ? x.click() : clearInterval(smt), console.log('done')}, 1000)
  5. It will output a number. Wait for it to say “done” in the console. This may take a long time. you'll notice the scrollbar changing while it's loading all advertisers.
  6. Copy-paste this and press enter:

Keybase proof

I hereby claim:

  • I am scarlac on github.
  • I am scarlac (https://keybase.io/scarlac) on keybase.
  • I have a public key ASDceRd1ij02J9C8XwWN-ACB7-7X7s6ipdnhzVa0J-csAgo

To claim this, I am signing this object:

@scarlac
scarlac / server.js
Created May 1, 2019 17:41
File Upload Server
const app = require('express')();
const upload = require('multer')();
app.post('/upload', upload.single('file'), function (req, res) {
console.log('file', req.file);
res.status(200).send(JSON.stringify({ ...req.file, buffer: null }));
});
app.listen(4242, () => { console.log('ready.'); });