Skip to content

Instantly share code, notes, and snippets.

View ivanbuncic's full-sized avatar
🏠
Working from home

Ivan Buncic ivanbuncic

🏠
Working from home
View GitHub Profile
@ivanbuncic
ivanbuncic / introrx.md
Created July 19, 2019 23:24 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ivanbuncic
ivanbuncic / unicode-matching-regex.js
Created January 26, 2019 18:44
Regex matching UNICODE - From the book 'Secrets of the JavaScript Ninja 2'
const text = "\u5FCD\u8005\u30D1\u30EF\u30FC";
const matchAll = /[\w\u0080-\uFFFF_-]+/;
console.log(text.match(matchAll), "Our regexp matches non-ASCII!");
@ivanbuncic
ivanbuncic / compressor.js
Created January 26, 2019 18:26
Regex compressor - From the book 'Secrets of a JavaScript Ninja 2'
function compress(source) {
const keys = {};
source.replace(
/([^=&]+)=([^&]*)/g,
function(full, key, value) {
keys[key] =
(keys[key] ? keys[key] + "," : "") + value;
return "";
}
);