Skip to content

Instantly share code, notes, and snippets.

View Adizbek's full-sized avatar

Ergashev Adizbek Adizbek

  • Realsoft
  • Tashkent, Uzbekistan
View GitHub Profile
@lazerg
lazerg / file_to_base64.js
Created February 23, 2022 04:52
Promise based file to base64 conversion
/**
* Converts file to base64
*
* @param {File} file
* @return {Promise<String>}
*/
export default file => {
return new Promise(resolve => {
const reader = new FileReader();
reader.readAsDataURL(file);
@lazerg
lazerg / LoadingMixin.js
Last active January 22, 2022 20:21
Mixin for vuejs 2 to handle loading statuses.
const DEFAULT = null;
const IS_LOADING = 0;
const IS_LOADED = 1;
const IS_FAILED = 2;
export default {
data: {
loading: DEFAULT,
},
@kousu
kousu / README.md
Last active April 14, 2024 00:55
Using jose-util with ed25519 (aka EdDSA), PEM-formatted, keys

Using jose-util with ed25519 (aka EdDSA), PEM-formatted, keys

Using go-jose takes a bit of a knack. And it turns out there's a snag if you want to use the latest and greatest crypto.

I installed jose-util from the latest git version:

$ pwd
/Users/kousu/src/go-jose
anaesthetic-mac:go-jose kousu$ git log HEAD~1..HEAD
@sandeepsuvit
sandeepsuvit / angular-clipboard-event.html
Last active January 31, 2020 14:00
Angular2 clipboard paste event
<textarea placeholder="Type a message" (paste)="onPaste($event)"></textarea>
<!-- Place to render the image -->
<img #imgRenderer />
@lyhcode
lyhcode / zlib-demo.js
Created April 2, 2012 10:38
Node.js + Gzip/Deflate Compression
var zlib = require('zlib');
var compress = function(req, res, result) {
var acceptEncoding = req.headers['accept-encoding'];
if (!acceptEncoding) { acceptEncoding = ''; }
if (acceptEncoding.match(/\bdeflate\b/)) {
zlib.deflate(result, function(err, result) {
if (!err) {
res.writeHead(200, { 'content-encoding': 'deflate' });
res.send(result);