Skip to content

Instantly share code, notes, and snippets.

Javan Makhmali javan

Block or report user

Report or block javan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View inline-es-modules.js
const files = {
"m1.js": `import {func} from './m2.js'; console.log(func());`,
"m2.js": `export function func() { return 'abc'; }`
const urls = new Map
function getURL(filename) {
let url = urls.get(filename)
if (!url) {
javan /
Created Jul 8, 2019
macOS: Optimized Screenshots
😱 Before: ~/Desktop/Screen Shot….png 4.1 MB
🏆 After: ~/Screenshots/Screen Shot….png 937 KB


  1. Install
    $ brew install pngquant
javan /
Created Jun 11, 2019
Add SF Mono to Firefox (macOS only)

GitHub uses the following CSS font stack to display code:

font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;

Chrome will use SFMono-Regular when that font is installed locally, but Firefox will not. Workaround: Add the following CSS to your Firefox profile's userContent.css file:

@font-face {
javan / test.html
Last active Jun 24, 2018 — forked from triskweline/test.html
Custom Elements v0 vs. DOMParser
View test.html
<!doctype html>
<title>Custom elements test</title>
<h3>Custom elements from HTML</h3>
<ol class="from-html" start="0">
javan /
Created May 30, 2018
Ideas for improving webpack.config.js

This is the example webpack.config.js on

module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
getHexColor = (color) ->
return "" unless color
return color if /^#/.test(color)
rgbValues = getRGBValues(color)
hexValues =
"#" + hexValues.join("")
numberToHex = (number) ->
View buggy_mutation_observer_workaround.ts
(async () => {
if (await mutionObserverIsBuggy()) {
function mutionObserverIsBuggy(): Promise<boolean> {
return new Promise(resolve => {
const element = document.createElement("div")
element.innerHTML = "<a><em></em></a>"
javan /
Last active Mar 19, 2019
Active Storage direct uploads
javan / index.html
Created Jun 9, 2017
Electron <webview> document.visibiltyState
View index.html
<!DOCTYPE html>
<meta charset="UTF-8">
<div style="margin: 20px;">
&lt;webview&gt; visibilityState: <strong id="visibility-state"></strong>
<button id="update-visibility-state">Update</button>
javan /
Created Nov 28, 2016
<bc-require>: Basecamp 3's lazy JavaScript loader
BC.registerElement "bc-require",
createdCallback: ->
@setAttribute("pending", "")
attachedCallback: ->
BC.ready =>
if Loader.find(@script)?.loaded
You can’t perform that action at this time.