Skip to content

Instantly share code, notes, and snippets.

View subversivo58's full-sized avatar
📧
For critical issues, send me an email

Lauro Moraes subversivo58

📧
For critical issues, send me an email
View GitHub Profile
@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');
*/
@evanw
evanw / chart.png
Created September 20, 2012 03:13
WebSocket Speed Test
chart.png
//Uses the https://github.com/github-tools/github library under the hood and exposes it as `gh` property
function GithubAPI(auth) {
let repo;
let filesToCommit = [];
let currentBranch = {};
let newCommit = {};
//the underlying library for making requests
let gh = new GitHub(auth);
@mmtftr
mmtftr / byepopups.user.js
Created January 31, 2017 11:37
Byepopups!
// ==UserScript==
// @name Byepopups!
// @namespace http://mehmetefeakca.me/
// @version 0.001
// @description try to remove all those nasty popups that happen when you click anything in the website! They do suck..
// @author MMTF
// @match *://*/*
// @grant none
// @run-at document-start
// ==/UserScript==
@coolaj86
coolaj86 / github-pages-https-lets-encrypt.md
Last active November 16, 2021 22:36
Github Pages: Let's Encrypt!
@pradipchitrakar
pradipchitrakar / decrypt.js
Last active November 4, 2021 19:07
AES Encrypt data in php and decrypt in node js.
//require cyrpto module
var crypto=require('crypto');
//key and iv should be same as the one in encrypt.php
var decipher=crypto.createDecipheriv('aes-256-cbc','12345678901234561234567890123456','1234567890123456');
//since we have already added padding while encrypting, we will set autopadding of node js to false.
decipher.setAutoPadding(false);
// copy the output of encrypt.php and paste it below
@fundon
fundon / count_utf8.js
Created May 21, 2012 14:39 — forked from frne/count_utf8.js
Function to count bytes of a string (UTF8)
/**
* Function to fix native charCodeAt()
*
* Now, we can use fixedCharCodeAt("foo€", 3); for multibyte (non-bmp) chars too.
*
* @access public
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/charCodeAt
* @note If you hit a non-bmp surrogate, the function will return false
* @param str String Mixed string to get charcodes
* @param idx Integer Position of the char to get
const describe = (desc, fn) => {
console.log(desc)
fn()
}
const it = (msg, fn) => describe(' ' + msg, fn)
const matchers = (exp) => ({
toBe: (asssertion) => {
if (exp === assertion) {
@uupaa
uupaa / canvas.toDataURL.image.webp.md
Last active April 11, 2021 13:37
canvas.toDataURL("image/webp");
<canvas id="canvas"></canvas>
<script>
var ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(0, 0, 8, 8);

var webp = canvas.toDataURL("image/webp"); // Chrome only?
var png  = canvas.toDataURL("image/png");
var jpg = canvas.toDataURL("image/jpeg");
@barretts
barretts / css-filter-generator-to-convert-from-base-hex-color-to-target-hex-color.markdown
Last active March 26, 2021 09:15
CSS filter generator to convert from black to target hex color