This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var $t = $('.thumbcaption'), | |
$i =$('.image img'), | |
r="", md, i; | |
for(i=0; i < $t.length; i++){ | |
r+=("![" + $($t[i]).text().replace(/(\r\n|\n|\r)/gm,"")+"]("+$($i[i]).attr('src').replace(/(\/thumb\/)/gm, "/").replace(/\.(png|svg|jpg|jpeg|bmp|gif)\/.*$/gm, ".$1")+")\n" ) | |
} | |
md = r+'\nImages from ["'+$('#firstHeading').text()+'" on wikipedia]'+'('+document.location.href+')\n'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
echo "Url to extract values from:"; | |
read TMPCURLURL; | |
RESULT=`curl -L $TMPCURLURL`; | |
# Extract urls within double quotes | |
echo $RESULT | grep -oE "\"http://.*\"" | cut -d " " -f1 | cut -d '"' -f2; | |
# Extract urls within single quotes | |
echo $RESULT | grep -oE "'http://.*'" | cut -d " " -f1 | cut -d "'" -f2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extract JSON table of content from any given french Legal code | |
// ============================================================== | |
// author: @daformat <mat.jouhet[at][google's mail service].com> | |
// lastmod: 2017/01/10 | |
// | |
// Usage: | |
// ------ | |
// Execute in javascript console while browsing the toc you're interested in | |
// see comments if you need to tweak anything. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Basic transliteration helper */ | |
function transliterate(str) { | |
return str.replace(/[ÀÁÂÃÄÅ]/g, 'A') | |
.replace(/[Æ]/g, 'AE') | |
.replace(/[Ç]/g, 'C') | |
.replace(/[ÈÉÊË]/g, 'E') | |
.replace(/[ÌÍÎÏ]/g, 'I') | |
.replace(/[Ñ]/g, 'N') | |
.replace(/[ÒÓÔÕÖ]/g, 'O') | |
.replace(/[Œ]/g, 'OE') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is more a simple and naive proof of concept than anything | |
it's based on [this answer](https://stackoverflow.com/a/41077092/1358317) | |
on stackoverflow. | |
*/ | |
(function() { | |
// Create the audio context | |
var audioCtx = new(window.AudioContext || window.webkitAudioContext)(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Spaces information was found on http://jkorpela.fi/chars/spaces.html | |
// and https://en.wikipedia.org/wiki/Tab_key#Unicode | |
{ | |
// Display booleans or ✅ ❌ emojis | |
const useEmojiForBooleans = true; | |
// Spaces are to be tested against the following regular expressions | |
const testRegexps = [ | |
/\s/, // White-space charcater class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Create a html input slider to set the current html document root font-size | |
// @returns the ref to the inserted DOM element | |
const createRootFontSizeSlider = (min = 8, max = 18) => { | |
const i = document.createElement("input") | |
i.type = "range" | |
i.min = `${min}` | |
i.max = `${max}` | |
i.step = "0.01" | |
i.style = "position: fixed; bottom: 24px; right: 24px; z-index: 2147483647" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------------------------------------------- | |
// This is the foundation for a typed translation helper | |
// with autocomplete, intellisense, and type-checking | |
// ----------------------------------------------------- | |
// TS playground link: | |
// https://www.typescriptlang.org/play?#code/PTAEFpK6dv4fAUCUAVAFgSwM6l6AC4YCmoAZgPYCuAdgCYCGhWltFlATqI0QJ4AHEvSKdGtHABtmrdqUlDOKMAHcsxHtUKUAxpQC2AySUIkANPlqnJk3CQnmeDfkPA7SOgNZZaAc2UQiEHBIbBIAQBCjDjCoGxE2HgA2vQmjFjGIuI4KiScALoAFBiEhAI4AFwgOISMXpQAbnnkkpQqAHR6+sCMwACsABwAzAAMAwBMAOwAnMAAjEODQ3OTAJQB8RhtRJQuZO4kXqLi0iybJAp5OOGoUMcSp7J7eOIirb5YOoHgAaF-YSgAFSApCgQGgKIxe5SGTxQiCRy5ADknDIKi43j8oDUGhqnB8vjwXDiACMAFaHQh4HEYUB4gnXMHAJDwoSgADKhHxfgA8pxOdzfDzyZTQABeOlcgmgAA+oAA3qAkgAPCqSwX5NUCgl87W8kU6QigAC+N2BoPBAEFaHxQA1GLYRAJmLSqNxeB8muxKAajTzQAJOJRFCwSDgLD4dJJqPRpbQw6YnUGQ1gwxbmayyMKKYaAAougA8PIAfOLQP6SMrTAw8AAlQ5cegF+l+Cx6oX8qX6nOEYug0AAfgV-dAo6VAGlLKBPCQ+JRyOX8uABxUR2PR3KAAYAEnlk4AZOqCcbN2v11vdwBhNg6ZhoSj54gFg9H1vl32PjBFpLj-LF4snmuxpJDOc4Ljy+T9mqABE0FmiCYIQtQGROi6r6+HE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
/* | |
This code is mostly a quick and somewhat dirty demo to explore the concept of selecting DOM nodes visually | |
It's far from being bulletproof and the code could definitely be cleaner. | |
Copy paste it into your browser javascript console then click back inside the document or hide | |
the devtools so you can use the keyboard shorctus to update selection, otherwise the keystrokes | |
will be captured by the console. | |
The support for text selection is still quite basic but it's included for demonstration purposes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper to get the flag emoji for a given country code | |
* @param {string} countryCode | |
* @returns {string} | |
*/ | |
const getFlagEmoji = (countryCode) => { | |
const codePoints = countryCode | |
.toUpperCase() | |
.split('') | |
.map(char => 0x1f1a5 + char.charCodeAt(0)); |
OlderNewer