Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

Linr Linrstudio

View GitHub Profile
View dynamic-long-shadow.js
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);
}
View qs.js
// code taken from visionmedias node-querystring
var qs = (function () {
var qs = {}
/**
* Object#toString() ref for stringify().
*/
var toString = Object.prototype.toString;
/**
View android-flex.css
.flex {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.flex.flex--reverse {
-webkit-box-orient: horizontal;
@Linrstudio
Linrstudio / hello-apple.md
Created Oct 20, 2015
solutions for window.innerWidth / innerHeight issue in iOS9
View hello-apple.md

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
@Linrstudio
Linrstudio / iOS: Fixed position elements on input focus
Last active Aug 29, 2015
iOS: Fixed position elements on input focus
View 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({
View EventTarget
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);
View events_spy.js
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);
You can’t perform that action at this time.