Skip to content

Instantly share code, notes, and snippets.

xem

Block or report user

Report or block xem

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
@xem
xem / index.html
Last active Aug 29, 2015
miniCodeEditor in 162b (Fx, Chrome, Opera)
View index.html
<body oninput='f.srcdoc=t2[v="value"]+"<script>"+t0[v]+"</script><style>"+t1[v]'onload='for(i=3;i--;)e.innerHTML+="<textarea id=t"+i+" rows=9>"'id=e><iframe id=f>
@xem
xem / index.html
Created Jun 26, 2014
A Pen by xem.
View index.html
<div class="content smallSizeLayout">
<div class="intro" data-stretch-parent-if-n-lines="2" data-stretch-parent=".content" data-bind="css:{ 'bulletHidden': !isVisited()}" id="id_186">
<p data-bind="html:text"><div class="richText"><p>Intro: Lorem ipsum dolor sit, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa</p></div></p>
</div>
<table class="bulletpoint bulletHidden first">
<tbody>
<tr>
<td class="bullet-icon">
@xem
xem / gist:f2a98e4df3ae3076b8fd
Last active Aug 29, 2015
log the binary content of files dropped in the browser. also works for multiple files.
View gist:f2a98e4df3ae3076b8fd
<html ondrop="f(event);return!1"ondragover=return!1>
<script>
f=function(e){
d=e.dataTransfer.files;
for(i=0;i<d.length;i++){
with(new FileReader){
readAsArrayBuffer(d[i]);
onload=function(){console.log(new Uint8Array(result))};
}
}
View gist:cf8c21239c39f2c6ce27
<html ondrop="f(event);return!1"ondragover=return!1>
<script>
f=function(e){
r=new FileReader;
d=e.dataTransfer.files;
for(i=0;i<d.length;i++){
r.readAsArrayBuffer(d[i]);
}
r.onload=function(a){
console.log(r.result); // wat? If I drop multiple files, there's only one ArrayBuffer there (on FF) and it doesn't work at all (on chrome)
View gist:670dec8e70815842eb95
<!-- solution 1, 117b, inspired by http://www.p01.org/releases/140bytes_music_softSynth/ -->
<button onclick="new Audio('data:audio/wav;base64,UklGRl9vT19XQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YU'+Array(1e3).join(123)).play()">Beep</button>
<!-- Solution 2, 107b, inspired by http://xem.github.io/chip8/c8.html -->
<button onclick="o=(A=new AudioContext()).createOscillator();o.connect(A.destination);o.start(0);setTimeout('o.stop(0)',500)">Boop</button>
View README.md

Mini Mini Game of life

A game of line engine where everything that can be passed as parameter, is.

Score: 81b.

@xem
xem / README.md
Last active Aug 29, 2015 — forked from 140bytes/LICENSE.txt
Mini string encoders for the Web
View README.md

Mini string encoders/decoders for the Web

Here's a list of tiny functions whose goal is to convert any Unicode string in 28 different formats used on the Web, and do the reverse operation.

An online converter using those functions can be found here: http://xem.github.io/escape

Please contribute in the comments (or by pull request) if you have a feature idea or a code-golf improvement to make or a bug to solve.

NB: to be as short as possible, all those functions assume a valid input and convert all chars (including ASCII chars and non-ASCII chars that don't really need to be converted in some cases).

@xem
xem / codegolf.md
Last active Jul 29, 2019
JS code golfing
View codegolf.md

codegolf JS

Mini projects by Maxime Euzière (xem), subzey, Martin Kleppe (aemkei), Mathieu Henri (p01), Litterallylara, Tommy Hodgins (innovati), Veu(beke), Anders Kaare, Keith Clark, Addy Osmani, bburky, rlauck, cmoreau, maettig, thiemowmde, ilesinge, adlq, solinca, xen_the,...

(For more info and other projects, visit http://xem.github.io)

(Official Slack room: http://jsgolf.club / join us on http://register.jsgolf.club)

@xem
xem / draft.md
Last active Aug 29, 2015
Character encodings on the Web
View draft.md

Introduction

Every single component of the Web handles strings, and especially Unicode characters encoding, differently.

This document aims to gather all the important information about character encodings on the Web.

File charsets

You can’t perform that action at this time.