Skip to content

Instantly share code, notes, and snippets.

View mr21's full-sized avatar
💭
"What I produce is 99.1% pure" - Walter White

Thomas Tortorini mr21

💭
"What I produce is 99.1% pure" - Walter White
View GitHub Profile
/*
Here is the element HTML you have to put in your page
for make appear the magic :)
This element is in "inline-block".
<div class="windows8-loading">
<b></b>
<b></b>
<b></b>
<b></b>
<b></b>
/*
<!-- Here is the HTML necessary for the script. -->
<div class="canvasloth">
<div class="canvasloth-assets">
<!-- here goes the assets -->
<img src="image.png"/>
</div>
<div class="canvasloth-hud-below">
<!-- here goes the HUD unclickable -->
<span class="score">0000</span>
@mr21
mr21 / JavaScript-101.js
Last active November 28, 2015 12:03
JavaScript - first lesson
<script>
var v = "0";
if (v && v == 0) { /* So it's `true` but... also `0` ? */
v = null;
if (v == undefined) { /* `null` but equal to `undefined` well... */
v = new Array(10, 11);
if (v[0] === 10 && v[1] === 11) { /* Oh! I understood this one! */

Les tableaux à deux dimensions en C


int ** tab = malloc(3 * sizeof *tab);
tab[0] = malloc(4 * sizeof **tab);      /*             /-----> [0][1][2][3]    */
tab[1] = malloc(4 * sizeof **tab);      /*            /                        */
tab[2] = malloc(4 * sizeof **tab);      /*    [0] ---/                         */
window.vardump = function(o) {
switch (typeof o) {
case "string":
return '"' + o + '"';
case "boolean":
case "undefined":
case "number":
case "function":
return o;
case "object":
@mr21
mr21 / draw_line.js
Last active August 29, 2015 14:17
The optimize version of Bresenham's line algorithm in JavaScript. http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
function line(
x1, y1,
x2, y2,
r, g, b, a
) {
x1 = Math.round(x1);
y1 = Math.round(y1);
x2 = Math.round(x2);
y2 = Math.round(y2);
var dx, dy, e;
## argv
ls
ls -l
ls -l -a
ls -l -a -S
ls -l -a -S -r
/bin/ls
/bin/ls -l
/bin/ls -l -a
/bin/ls -l -a -S
/*
[ Reminder ]
## List of the events
focus :
blur :
fullscreenchange : { isFullscreen }
keydown : { key } // ASCII code
@mr21
mr21 / ie-version.js
Last active August 29, 2015 14:23
IE 10/11/+ don't read the condinationnal comments anymore.
var ie = document.documentMode;
if (ie) {
var htmlClass = " ie ie" + ie;
switch (ie) {
case 6: htmlClass += " lte6";
case 7: htmlClass += " lte7";
case 8: htmlClass += " lte8";
case 9: htmlClass += " lte9";
case 10: htmlClass += " lte10";
case 11: htmlClass += " lte11";