Skip to content

Instantly share code, notes, and snippets.

View Linrstudio's full-sized avatar
🌴
On vacation

xyz Linrstudio

🌴
On vacation
View GitHub Profile
I have the script events_spy.js:
(function(original) {
Element.prototype.addEventListener = function(type, listener,
useCapture) {
if (typeof (this._handlerTypes) == 'undefined') {
this._handlerTypes = {};
}
this._handlerTypes[type] = true;
return original.apply(this, arguments);
var $preventAllEvents = $('input');
// The magic code
var oldAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(eventName, eventHandler)
{
oldAddEventListener.call(this, eventName, function(event) {
if(!$preventAllEvents.is(':checked'))
eventHandler(event);
@Linrstudio
Linrstudio / iOS: Fixed position elements on input focus
Last active August 29, 2015 14:26
iOS: Fixed position elements on input focus
$(document).ready(function() {
$("input, select, textarea").on('focus', function() {
$("#header").css({
'position': 'absolute',
'top': $(document).scrollTop()
});
focusing = true;
})
$("input, select, textarea").on('blur', function() {
$("#header").css({
@Linrstudio
Linrstudio / hello-apple.md
Created October 20, 2015 06:44
solutions for window.innerWidth / innerHeight issue in iOS9

iOS9 returns double the value for window.innerWidth & window.innerHeight
The versions that are concerned are: 9.0.0, 9.0.1, 9.0.2

A few people got mad on twitter:

window.innerWidth in iOS 9 Safari returns double the number it did in iOS 8? Is this real life? tell me no — @rachsmithtweets
iOS9 Safari has the most insane bug where window.innerWidth / innerHeight is *sometimes* twice as large as it should be. ughhhh. !? — @mattdesl

iOS9 innerWidth/innerHeight is having a lot of fun these days — @ayamflow

.flex {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.flex.flex--reverse {
-webkit-box-orient: horizontal;
@Linrstudio
Linrstudio / qs.js
Created December 28, 2015 02:07 — forked from drewlesueur/qs.js
// code taken from visionmedias node-querystring
var qs = (function () {
var qs = {}
/**
* Object#toString() ref for stringify().
*/
var toString = Object.prototype.toString;
/**
Math.radians = function(degrees) {
return degrees * Math.PI / 180;
};
Math.degrees = function(radians) {
return radians * 180 / Math.PI;
};
Math.ctg = function(val) {
return 1/Math.tan(val);
}