Skip to content

Instantly share code, notes, and snippets.

Avatar

Seph Soliman scarlac

View GitHub Profile
@scarlac
scarlac / react-native+0.61.2.patch
Last active Feb 10, 2020
Patch to trigger onDismiss for iOS 13-style pageSheet/formSheet modals
View react-native+0.61.2.patch
diff --git a/node_modules/react-native/React/Views/RCTModalHostView.h b/node_modules/react-native/React/Views/RCTModalHostView.h
index e421e59..ba461e0 100644
--- a/node_modules/react-native/React/Views/RCTModalHostView.h
+++ b/node_modules/react-native/React/Views/RCTModalHostView.h
@@ -17,7 +17,7 @@
@protocol RCTModalHostViewInteractor;
-@interface RCTModalHostView : UIView <RCTInvalidating>
+@interface RCTModalHostView : UIView <RCTInvalidating, UIAdaptivePresentationControllerDelegate>
@scarlac
scarlac / server.js
Created May 1, 2019
File Upload Server
View server.js
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.'); });
View keybase.md

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 / purge_advertisers.md
Last active Jun 7, 2021
Facebook Hack: Purge list of "Advertisers you've interacted with"
View purge_advertisers.md

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:
@scarlac
scarlac / gist:777c070912e9fe90f1330d493591360f
Created Mar 25, 2018
Test of Slack link og:title escaping feature, tag here: <Slack>
View gist:777c070912e9fe90f1330d493591360f
Test of Slack link og:title escaping feature, tag here: <Slack>
@scarlac
scarlac / scandinavian-name-generator.js
Created Feb 9, 2018
"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.
View scandinavian-name-generator.js
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 / prototype-vs-arrowfn.js
Last active Dec 2, 2017
Benchmark comparison of 'clever' prototype trick vs arrow function call
View prototype-vs-arrowfn.js
const arr = [
'Duis',
' felis ',
' ex ',
'finibus',
' vitae ',
' tempus ',
' ut ',
'commodo',
' nec ',
@scarlac
scarlac / asyncawaitvspromises.js
Last active Nov 23, 2017
Async/await transpiled by hand to Promises
View asyncawaitvspromises.js
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 / FourSquareAPI.md
Last active Dec 23, 2016
FourSquare undocumented API
View FourSquareAPI.md

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 |

View keybase.md

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: