Skip to content

Instantly share code, notes, and snippets.

View masak2009's full-sized avatar

Martin Rychlovsky masak2009

View GitHub Profile
@steveh80
steveh80 / grid.scss
Last active April 16, 2020 10:32
Bootstrap viewport detection in Javascript
// needed for viewport size detection in javascript
body::before {
display: none;
content: "xs";
}
@media (min-width: $screen-sm-min) {
body::before {
content: "sm";
}
@wteuber
wteuber / encrypt_decrypt.rb
Last active February 2, 2026 15:13
Basic encrypt and decrypt Strings in Ruby with deterministic salt or IV, generate and store random salt and IV in production
require 'openssl'
class String
CIPHER_NAME = 'aes-256-cbc'.freeze
PBKDF_ITER = 200_000
KEY_LEN = 32 # 256 bits
SALT_CONST = "fixed-global-salt-v1".freeze
IV_SALT_CONST = "fixed-iv-salt-v1".freeze
def encrypt(password)