Skip to content

Instantly share code, notes, and snippets.

View mathiasbynens's full-sized avatar

Mathias Bynens mathiasbynens

View GitHub Profile
> eshost host --list
┌──────────────┬─────────┬────────────────────────────────────────────────────┬─────────┐
│ name │ type │ path │ args │
├──────────────┼─────────┼────────────────────────────────────────────────────┼─────────┤
│ chakra │ ch │ C:\Users\brterlso\projects\runify\hosts\ch.exe │ │
├──────────────┼─────────┼────────────────────────────────────────────────────┼─────────┤
│ node │ node │ c:\Program Files\nodejs\node.exe │ │
├──────────────┼─────────┼────────────────────────────────────────────────────┼─────────┤
│ spidermonkey │ jsshell │ C:\Users\brterlso\projects\runify\hosts\js.exe │ │
├──────────────┼─────────┼────────────────────────────────────────────────────┼─────────┤
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active June 10, 2024 15:16
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@cowboy
cowboy / files.txt
Last active August 29, 2015 14:25
Pizzicato Five ‎– The Band Of 20th Century
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 01 Intro.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 02 The Night Is Still Young.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 03 A New Song.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 04 Serial Stories.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 05 Triste.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 06 Sweet Soul Revue.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 07 To Our Children’s Children’s Children.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 08 Ma Vie, L’ete De Vie.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 09 Drinking Wine.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 10 Goodbye Baby & Amen.mp4
@RReverser
RReverser / es6-intrinsic.js
Created June 14, 2015 14:04
ES6 spec: 6.1.7.4 Well-Known Intrinsic Objects
/*
The MIT License (MIT)
Copyright (c) 2015 Ingvar Stepanyan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@mems
mems / gist:d54ad804d8d8d17d0011
Last active October 24, 2022 03:24
Found the Apple live stream URL
  1. Open http://www.apple.com/live/ which redirect to something like http://www.apple.com/live/2015-june-event/
  2. Find a loaded script like: /live/2015-june-event/scripts/2015-june-event.built.js
  3. Open this script and search p.events-delivery.apple.com.edgesuite.net You find something like http://p.events-delivery.apple.com.edgesuite.net/15pijbnaefvpoijbaefvpihb06/js_files/event
  4. append to it /url.json (details: host + path + url.json)
  5. Open the generated URL
  6. Found an URL like http://p.events-delivery.apple.com.edgesuite.net/15pijbnaefvpoijbaefvpihb06/m3u8/hls_mvp.m3u8

Now you can watch it in VLC or any other videoplayer that support M3U and MP4(H264+AAC)!

ES7 String trim functions

String.prototype.trim ( )

Return result of StringTrim abstract operation passing this value as thisArg, and TrimBoth as the type.

String.prototype.trimRight ( )

Return result of StringTrim abstract operation passing this value as thisArg, and TrimRight as the type.

var uk = createFuzzyScorer('United Kingdom');
var us = createFuzzyScorer('United States');
console.log([
uk('United') > uk('uk'),
uk('nited') > uk('ingdom'),
uk('united kingdom') > uk('united kingdo'),
uk('united dom') < uk('united kin'),
uk('knited k') > uk('dom'),
uk('_united_') < uk('united'),
@cowboy
cowboy / quine-examples.js
Last active December 23, 2023 08:51
A few JavaScript quines
// Today, I noticed that someone favorited this tweet of mine from 2012:
// https://twitter.com/cowboy/status/232587756486938624
// !function $(){console.log('!'+$+'()')}() #quine
// So I fooled around for a little bit:
// Shortest JavaScript quine?
(function _(){return'('+_+')()'})()
// Have fun with this one!
@Robbert
Robbert / australian-ip.js
Created February 9, 2015 21:53
Australian IP address detection. Fast JavaScript proof of concept.
function isAustralianIP(n) {
return n >= 0x1000000 && (n >= 0x82740000 && (n >= 0xA5760000 && (n >= 0xCB1E1200 && (n >= 0xCBA60000 && (n >= 0xD2D74F00 && (n >= 0xDCEB0000 && (n >= 0xDCF40000 && (n >= 0xDD788000 && (n >= 0xDF1B4000 && (n >= 0xDFFFE800 && (n >= 0xDFFFFF00 || n <= 0xDFFFEBFF) || n <= 0xDFFC7FFF && (n <= 0xDFA57FFF && (n >= 0xDFA56000 || n <= 0xDF821FFF && (n <= 0xDF1DF3FF && (n >= 0xDF1BB000 && (n >= 0xDF1DF000 || n <= 0xDF1BB3FF) || n <= 0xDF1B67FF && (n <= 0xDF1B43FF || n >= 0xDF1B6000)) || n >= 0xDF820C00)) || n >= 0xDFFC0000)) || n <= 0xDF1B1FFF && (n >= 0xDD85C000 && (n >= 0xDF197000 && (n >= 0xDF1B1391 || n <= 0xDF1B138F && (n <= 0xDF19E7FF && (n >= 0xDF19E000 || n <= 0xDF1977FF) || n >= 0xDF1B0000)) || n <= 0xDEE55FFF && (n >= 0xDDC7D000 && (n >= 0xDEE55800 || n <= 0xDDC7DFFF) || n <= 0xDD85DFFF)) || n <= 0xDD799FFF && (n >= 0xDD798000 || n <= 0xDD795FFF && (n >= 0xDD794000 || n <= 0xDD78A7FF)))) || n <= 0xDCFDFFFF && (n >= 0xDCF7B000 && (n <= 0xDCF7B7FF || n >= 0xDCFD0000) || n <= 0xDC
@sfan5
sfan5 / image2xterm.py
Last active July 13, 2020 18:24
Converts images into color sequences (xterm-256color)
#!/usr/bin/env python3
import sys
import getopt
from PIL import Image
xterm256colors = [ # http://pln.jonas.me/xterm-colors
(0, (0x00, 0x00, 0x00)), # SYSTEM
(1, (0x80, 0x00, 0x00)), # SYSTEM
(2, (0x00, 0x80, 0x00)), # SYSTEM
(3, (0x80, 0x80, 0x00)), # SYSTEM