Skip to content

Instantly share code, notes, and snippets.

View steven89's full-sized avatar
🦦

Steven Salaun steven89

🦦
  • Freelance
  • Budapest, Hungary
View GitHub Profile
@steven89
steven89 / KeyboardAvoidingView.js
Created June 7, 2017 02:37
Work around for currently not working behavior='height' of KeyboardAvoidingView
/**
* Work around for currently not working behavior='height' of KeyboardAvoidingView
* Please note that this is just a way around the issue and not an actual fix
* Tested on:
* - iOS 10.2 (both simulator and actual device): react 16.0.0-alpha.6 & react-native 0.44.2
* @see https://github.com/facebook/react-native/issues/13754
* @see https://stackoverflow.com/questions/41616457/keyboardavoidingview-reset-height-when-keyboard-is-hidden
* @see https://github.com/facebook/react-native/blob/master/Libraries/Components/Keyboard/KeyboardAvoidingView.js#L163-L166
* Issues:
* - onLayout is not called when the keyboard is dismissed,
@chrisveness
chrisveness / crypto-aes-gcm.js
Last active May 11, 2025 11:17
Uses the SubtleCrypto interface of the Web Cryptography API to encrypt and decrypt text using AES-GCM (AES Galois counter mode).
/**
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt().
* (c) Chris Veness MIT Licence
*
* @param {String} plaintext - Plaintext to be encrypted.
* @param {String} password - Password to use to encrypt plaintext.
* @returns {String} Encrypted ciphertext.
*
* @example
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw');
@tomysmile
tomysmile / mac-setup-redis.md
Last active July 10, 2025 21:05
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@weapp
weapp / nginx.conf
Created August 4, 2014 17:21
Return common errors as json in Nginx
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
}
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
}
@Stanback
Stanback / nginx.conf
Last active March 30, 2025 03:57 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which