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>

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.'); });
@scarlac
scarlac / react-native+0.61.2.patch
Last active February 10, 2020 17:23
Patch to trigger onDismiss for iOS 13-style pageSheet/formSheet modals
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>