Skip to content

Instantly share code, notes, and snippets.

View eyecatchup's full-sized avatar

Stephan Schmitz eyecatchup

View GitHub Profile
@chrisveness
chrisveness / crypto-aes-gcm.js
Last active March 17, 2024 15:36
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');
@chrisveness
chrisveness / crypto-sha.js
Last active July 20, 2023 04:45
Uses the SubtleCrypto interface of the Web Cryptography API to hash a message using SHA-256.
/**
* Returns SHA-256 hash from supplied message.
*
* @param {String} message.
* @returns {String} hash as hex string.
*
* @example
* sha256('abc').then(hash => console.log(hash));
* const hash = await sha256('abc');
*/
@adamreisnz
adamreisnz / package.json
Last active January 19, 2024 13:01
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",
@eyecatchup
eyecatchup / material-design-breakpoints.css
Last active December 4, 2020 20:08
CSS media queries based on the breakpoint guidance published by the Material Design team. http://www.google.com/design/spec/layout/adaptive-ui.html#adaptive-ui-breakpoint
/* Material Design Adaptive Breakpoints */
/*
Below you'll find CSS media queries based on the breakpoint guidance
published by the Material Design team. You can choose to use, customise
or remove these breakpoints based on your needs.
http://www.google.com/design/spec/layout/adaptive-ui.html#adaptive-ui-breakpoints
*/
/* mobile-small */
@eyecatchup
eyecatchup / gist-toc.js
Last active March 7, 2019 21:57 — forked from ukyo/gist-toc.js
toc tree for gist
(function(l, l2, s) {
l2 = l2 || 6;
NodeList.prototype.forEach = [].forEach;
NodeList.prototype.slice = [].slice;
var toc = document.createElement('div');
var headerLevel = l || 2;
var tocStyle = s || 'ul';
@eyecatchup
eyecatchup / cygwin-gitbash-composer.md
Last active April 16, 2017 13:07
"Fix" `composer: unknown command` for Cygwin / Gitbash.

Cygwin/Gitbash + composer = unknown command

If you're working on a Windows machine and have the composer.bat in your $PATH (or %PATH%), Cygwin's Mintty terminal as well as the Gitbash will still complain about composer not being a known command.


If you try to use composer from a Mintty/Gitbash terminal, you'll get something like:

@webteckie
webteckie / keystone_roles_permissions.md
Last active November 21, 2021 11:35
Keystone Roles and Permissions

Keystone Roles & Permissions Support

The following documents the user permission support in keystone based on the support being added via PR #2111. Permissions are based on roles. If a user has a role and the list also specifies that role for any of its CRUD operations then it is permissive for the user to perform whichever CRUD operation matches the role. All users must define, at least, one role. The following are guidelines for adding role/permission support to your application:

Define a Role List Model:

@WebReflection
WebReflection / certificate.sh
Last active July 1, 2020 18:08
A basic Self Signed SSL Certificate utility
#!/usr/bin/env bash
# A basic Self Signed SSL Certificate utility
# by Andrea Giammarchi @WebReflection
# https://www.webreflection.co.uk/blog/2015/08/08/bringing-ssl-to-your-private-network
# # to make it executable and use it
# $ chmod +x certificate
# $ ./certificate # to read the how-to
@eyecatchup
eyecatchup / adv-js.md
Last active June 20, 2018 13:26
Some advanced JavaScript Hashing/Inflate/Deflate/Encryption/Decryption/Encoding/Decoding implementations

Advanced JavaScript Implementations

Some advanced (and mainly "math"-related) JS implementations of commonly used algorithms by [Masanao Izumo], <iz@onicos.co.jp>.

Disclaimer: ALL text below was translated, from Japanese, with Google Translator.
Sounds (almost) reasonable to me. But no warranty, though! ;-)

--

@eyecatchup
eyecatchup / win-ruby-ssl-error.md
Created July 29, 2015 02:26
SSL Error with Ruby on Windows when trying to install a gem from command line.

[Solved] The SSL_connect returned=1 errno=0 state=SSLv3 read server certificate-Error on Ruby for Windows

The Issue

When you try to install (or update) a Ruby gem from your Windows command line and get an error like, for example, the following:

> gem install compass
ERROR:  Could not find a valid gem 'compass' (>= 0), here is why:
        Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/latest_specs.4.8.gz)