Skip to content

Instantly share code, notes, and snippets.

Lauro Moraes subversivo58

View GitHub Profile
@joshuabaker
joshuabaker / languages.json
Created Mar 19, 2020
List of languages with ISO 639-1 Alpha-2 codes in JSON.
View languages.json
[
{
"code": "aa",
"name": "Afar",
"native": "Afar"
},
{
"code": "ab",
"name": "Abkhazian",
"native": "Аҧсуа"
@WesThorburn
WesThorburn / adding_wasm_MIME.md
Last active Jul 3, 2020
Webassembly, wasm files, webservers and MIME types
View adding_wasm_MIME.md

When compiling client files to webassembly, usually you'll end up with both .js and .wasm files. By default, most webservers don't know about the wasm MIME type. You'll likely see the following error: wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.

Here is how to add the wasm MIME type (on linux systems, apache + nginx):

Open /etc/mime.types You'll see two columns, media type on the left, file type on the right Add the line application/wasm wasm

View index.js
const describe = (desc, fn) => {
console.log(desc)
fn()
}
const it = (msg, fn) => describe(' ' + msg, fn)
const matchers = (exp) => ({
toBe: (asssertion) => {
if (exp === assertion) {
@ebidel
ebidel / feature_detect_es_modules.js
Last active Jun 17, 2020
Feature detect ES modules: both static import and dynamic import()
View feature_detect_es_modules.js
<!--
Complete feature detection for ES modules. Covers:
1. Static import: import * from './foo.js';
2. Dynamic import(): import('./foo.js').then(module => {...});
Demo: http://jsbin.com/tilisaledu/1/edit?html,output
Thanks to @_gsathya, @kevincennis, @rauschma, @malyw for the help.
-->
@kenmazaika
kenmazaika / README.md
Last active Apr 19, 2019
Showdown Markdown extension
View README.md

Markdown Extensions for Wells and PrismJS

Hello

foo
```javascript:4,5-7
hello
```
@barretts
barretts / css-filter-generator-to-convert-from-base-hex-color-to-target-hex-color.markdown
Last active May 21, 2020
CSS filter generator to convert from black to target hex color
View css-filter-generator-to-convert-from-base-hex-color-to-target-hex-color.markdown
View byepopups.user.js
// ==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==
View GithubApiPush.js
//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);
@kousherAlam
kousherAlam / server.js
Created Jan 21, 2017
This is a basic node js server, serve the web page,font ,image and video from public folder...
View server.js
const http = require("http"),
fs = require("fs"),
path = require("path"),
log = console.log;
//this will response with file type with specifiq content and encode
function response(res,file,contentType,encode){
if(file != "404"){
res.writeHead(200,{"Content-type":contentType});
if(encode){
@jherax
jherax / is-private-mode.js
Last active Jul 4, 2020
Detect if the browser is running in Private mode (Promise based)
View is-private-mode.js
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
*
* Live demo:
* @see https://output.jsbin.com/tazuwif
*
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js
*
You can’t perform that action at this time.