Skip to content

Instantly share code, notes, and snippets.

View teroyks's full-sized avatar

Tero Ykspetäjä teroyks

View GitHub Profile
@teroyks
teroyks / timeoutWrapper.js
Last active July 30, 2019 13:46
Javascript Timeout Wrapper
const DEFAULT_TIMEOUT = 5000;
// rejects a promise if it doesn't finish within given time
const timeout = async (promise, ms = DEFAULT_TIMEOUT) => {
const rejectAfterTimeout = new Promise((resolve, reject) => setTimeout(reject, ms, 'timed out'))
return Promise.race([
promise,
rejectAfterTimeout,
])
@teroyks
teroyks / 0React Router 4 Route with properties.md
Last active March 26, 2021 13:59
Passing properties to route components in React Router 4 (using TypeScript)

Wrapper components for passing properties to components in

<RouteWithProps> -- renders a component, passing properties to the target component

<AuthRoute> -- only renders the route if the auth parameter is true

`` -- renders a component, passing properties to the target component, only is the auth parameter is true

# Some-ohjeet
Kaikkia tarvittavia toimintoja voi käyttää Chromessa. Jos jokin tarvittava sovellus ei ole valmiiksi auki, linkki siihen löytyy kirjanmerkeistä.
*Muista, että kaikki päivitykset edustavat conia! Ole positiivinen ja ystävällinen kaikille!*
Pidä some-vuorossa silmällä seuraavia asioita (tarkemmat ohjeet alla):
- [Twitter](#twitter)
- Conin [Facebook](#facebook)-sivu
@teroyks
teroyks / php-mcrypt-homebrew.md
Last active June 6, 2021 19:49
Add PHP mcrypt extension on Mac OS X with Homebrew

You can install the mcrypt PHP extension with homebrew and use it with the standard PHP installation that comes with OS X.

Install mcrypt:

brew install mcrypt

Install the php extension -- this installs the whole php 5.5, but you can still use the system-provided one by default Note: install the version compatible with whatever your OS X PHP version currently is (check with php -v)

brew install homebrew/php/php55-mcrypt