Skip to content

Instantly share code, notes, and snippets.

View wirtaw's full-sized avatar
:octocat:
I may be slow to respond.

Vladimir Poplavskij wirtaw

:octocat:
I may be slow to respond.
View GitHub Profile
@rauschma
rauschma / create-enum.ts
Last active March 25, 2025 12:50
createEnum(): helper for creating enum objects
// More information on enum objects as an alternative to enums:
// https://2ality.com/2025/01/typescript-enum-patterns.html#alternative-to-enum%3A-object-literal-1
/**
* Returns an enum object. Adds the following improvements:
* - Sets the prototype to `null`.
* - Freezes the object.
* - The result has the same type as if `as const` had been applied.
*/
function createEnum<
@letanure
letanure / README.md
Created January 3, 2018 16:13 — forked from kerryboyko/README.md
VueJS Best Practices Guide

Deverus Vue.js Style Guide

Guide for developing Vue.js applications.

v. 0.0.1

Vue.js is an amazing framework, which can be as powerful as Angular or React, the two big heavy hitters in the world of front-end frameworks.

However, most of Vue's ease-of-use is due to the use of Observables - a pattern that triggers re-renders and other function calls with the reassignment of a variable.

@n1ru4l
n1ru4l / index.js
Created August 7, 2017 10:47
Fetch blob and convert to base64
export const fetchAsBlob = url => fetch(url)
.then(response => response.blob());
export const convertBlobToBase64 = blob => new Promise((resolve, reject) => {
const reader = new FileReader;
reader.onerror = reject;
reader.onload = () => {
resolve(reader.result);
};
reader.readAsDataURL(blob);
@branneman
branneman / create-zip.js
Last active July 30, 2021 20:59
Node.js script to create a zip file from a list of files and directories
const stat = require('fs').statSync;
const AdmZip = require('adm-zip');
/**
* Example usage
*/
newArchive(`test-${+new Date}.zip`, [
'index.js',
'package.json',
'node_modules'
@guilhermepontes
guilhermepontes / shuffle.js
Last active October 29, 2023 01:41
Shuffle Array - JavaScript ES2015, ES6
// original gist
const shuffleArray = arr => arr.sort(() => Math.random() - 0.5);
// fully random by @BetonMAN
const shuffleArray = arr => arr
.map(a => [Math.random(), a])
.sort((a, b) => a[0] - b[0])
.map(a => a[1]);
shuffleArray([1, 2, 3]) //[3, 1, 2]
@aravendy
aravendy / hello-world-threejs.html
Created December 14, 2016 22:08 — forked from salishdev/hello-world-threejs.html
Hello World with Three.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello, Three.js!</title>
<style>
body { margin: 0; }
canvas { width: 100%; height: 100%; }
</style>
</head>
var Util = require('util');
var Https = require('https');
var Tls = require('tls');
/**
* HTTPS Agent for node.js HTTPS requests via a proxy.
* blog.vanamco.com/connecting-via-proxy-node-js/
*/
function HttpsProxyAgent(options)
{
@ziadoz
ziadoz / awesome-php.md
Last active May 8, 2025 07:37
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.