Skip to content

Instantly share code, notes, and snippets.

View AdamMadrzejewski's full-sized avatar
🎯
Focusing

Adam AdamMadrzejewski

🎯
Focusing
  • Journey Digital
  • Auckland, New Zealand
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active April 16, 2024 17:32
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@mlynch
mlynch / info.plist
Last active August 6, 2023 07:31
Disable App Transport Security in iOS 9
<!--
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
platforms/ios/MyApp/MyApp-Info.plist
And add this XML right before the end of the file inside of the last </dict> entry:
@jlong
jlong / position.js
Last active July 18, 2022 11:03
Get the offset of an element relative to the viewport and take scrolling and borders into account
function getViewportOffset(element) {
var node = element
, left = node.offsetLeft
, top = node.offsetTop
;
node = node.parentNode;
do {
var styles = getComputedStyle(node);
@gunjanpatel
gunjanpatel / jdatabase.md
Last active November 14, 2022 12:26
Write subquery in Joomla 3 using JDatabase method.

Here is an example of how to write subquery in Joomla! 3 using JDatabase method.

<?php
// Initialize variables.
$db       = JFactory::getDbo();
$subQuery = $db->getQuery(true);
$query    = $db->getQuery(true);

// Create the base subQuery select statement.
@max-mapper
max-mapper / readme.md
Created August 19, 2012 05:18
put-a-closure-on-it

Put a closure on it

Sometimes you'll have objects that manage state along with event handling. This happens frequently in MVC apps. Let's start with a messy example:

var Launcher = function(rocket) {
  this.rocket = rocket
}

Launcher.prototype.isReady = function() {

@bretdavidson
bretdavidson / JSLint Options Descriptions
Last active October 5, 2018 22:37 — forked from dannygarcia/SublimeLinter.sublime-settings
Sublime Linter User Settings
anon true, if the space may be omitted in anonymous function declarations
bitwise true, if bitwise operators should be allowed
browser true, if the standard browser globals should be predefined
cap true, if upper case HTML should be allowed
continue true, if the continuation statement should be tolerated
css true, if CSS workarounds should be tolerated
debug true, if debugger statements should be allowed
devel true, if logging should be allowed (console, alert, etc.)
eqeq true, if == should be allowed
es5 true, if ES5 syntax should be allowed
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"