Skip to content

Instantly share code, notes, and snippets.

View teroyks's full-sized avatar

Tero Ykspetäjä teroyks

View GitHub Profile
@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

# 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 / 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

@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 / A_closure_example.php
Last active August 8, 2019 14:39
PHP closure usage example
<?php
$myReport = new MyReport;
$myReport->report();
// 2019-08-08: MyReport started
// 2019-08-08: using logReport
// 2019-08-08: Reporting: First report
// 2019-08-08: Reporting: Second report
@teroyks
teroyks / Ad style in Google search results.md
Last active January 24, 2020 13:28
Highlight ads in Google search results

Install a user scripts extension, for example Stylish for Chrome to enable custom styles for a website.

In Stylish, install a user style:

  1. Click on the Stylish icon on the Chrome toolbar, and select Create New Style from the action menu ( ⠇).
  2. Copy the CSS style from code.cssinto the Code field.
  3. Set the Applies to method to URLs matching the regexp and copy the value from URL regex.
  4. Give a name to your custom style and save.
@teroyks
teroyks / keybase.md
Created March 14, 2020 12:56
Keybase proof

Keybase proof

I hereby claim:

  • I am teroyks on github.
  • I am teroyks (https://keybase.io/teroyks) on keybase.
  • I have a public key ASCJsSjGzCiVzu4TCshLQwbWuCMYqmoTzxyWN5FsWozHVwo

To claim this, I am signing this object:

@teroyks
teroyks / pathlib.ipynb
Last active January 12, 2021 17:20
Pathlib Essentials
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@teroyks
teroyks / README.md
Last active November 17, 2021 09:17
Output a running count of lines

linecounter2 is an alternate version that goes to the previous line, erases it and rewrites with new info. Might be useful if you need the newline character at the end of the string (for example to flush an output buffer).

@teroyks
teroyks / valid_email_addresses.txt
Created December 14, 2021 16:03
Examples of valid email addresses that often trick validators
max.kaßner@bücher.de
kissa@localhost
"@"@example.com
"Joonas Koivunen"[email protected]