Skip to content

Instantly share code, notes, and snippets.

View Reinmar's full-sized avatar
🚀
Hello!

Piotrek Koszuliński Reinmar

🚀
Hello!
View GitHub Profile
@Reinmar
Reinmar / doom.js
Created October 23, 2011 14:27
Stupid DOM
({ r: window.webkitRequestAnimationFrame }).r(alert.bind(null, 1));
//Uncaught TypeError: Illegal invocation
({ r: window.mozRequestAnimationFrame }).r(alert.bind(null, 1));
//Error: Illegal operation on WrappedNative prototype object
var r = mozRequestAnimationFrame;
r.call(null, alert.bind(null, 1));
//ok, context is not important, so why can't I call DOM methods in whichever I want? :|
//because this is DOM!
@Reinmar
Reinmar / catch_me.php
Created October 19, 2011 13:26
PHP sucks
<?php
namespace x;
require 'catch_me2.php';
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
try {
\y\shittyCode();
}
@Reinmar
Reinmar / gist:1199370
Created September 7, 2011 00:14
Brainfuck
for(b=[],o='',i=c=l=0;u=s[i++];)l<0?u==']'&&l++:(b.push(0),u=='['?(l=b[c]?i-1:-1):u==']'?i=l:u=='.'?o+=b[c]:u=='+'?++b[c]:u=='-'?--b[c]:u=='>'?++c:u=='<'?--c:o)
@Reinmar
Reinmar / gist:1159049
Created August 20, 2011 12:36
Hoisting, function declarations vs function expressions
console.log('--------- Hoisting:');
(function () {
//console.log('3.1:', a); // -> ReferenceError
console.log('3.2:', b); // -> undefined
var b = 1;
'use strict';
console.log('--------- Scope:');
(function () {
var a = 1;
for (var a = 0; a < 10; ++a) {}
console.log('1.1:', a); // -> 10
@Reinmar
Reinmar / gist:1130767
Created August 7, 2011 20:41
Function expression vs Function declaration
a(); // -> ? :)
var a = function () {
console.log('a1');
};
function a() {
console.log('a2');
}
a(); // -> ? :)
var transform_property = (function (el) {
var properties = [
'transform',
'WebkitTransform',
'MozTransform',
'msTransform',
'OTransform'
];
var p;
while (p = properties.shift()) {
# HEAD detached at 4.4.4
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: plugins/a11yhelp/dialogs/a11yhelp.js
# deleted: plugins/a11yhelp/dialogs/lang/_translationstatus.txt
# deleted: plugins/a11yhelp/dialogs/lang/ar.js
# deleted: plugins/a11yhelp/dialogs/lang/bg.js
# deleted: plugins/a11yhelp/dialogs/lang/ca.js