Skip to content

Instantly share code, notes, and snippets.

@visiongeist
visiongeist / 2dqueries.js
Last active March 13, 2017 18:48 — forked from wbzyl/2dqueries.js
Example showing that MongoDB uses native units for regular 2d queries, and radians for spherical 2d queries
> db.dropDatabase();
{ "dropped" : "test", "ok" : 1 }
>
> // These points are one degree apart, which (according to Google Maps) is about 110 km apart
> // at this point on the Earth.
> db.points.insert({location: [-122, 37]});
> db.points.insert({location: [-122, 38]});
> db.points.ensureIndex({location:"2d"});
>
>
@visiongeist
visiongeist / what-forces-layout.md
Created February 13, 2017 13:57 — forked from paulirish/what-forces-layout.md
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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@visiongeist
visiongeist / LICENSE
Created October 25, 2016 08:12 — forked from shinout/LICENSE
Topological sort in JavaScript
Copyright 2012 Shin Suzuki<[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Page Title</title>
<meta name="description" content="">
</head>
<body>
</body>

AEM 6.2 Authoring Editor to Site messaging API

API

/**
 *
 * @param group {String} group identifier name
 * @param [targetWindow=window.parent]
 * @param [origin='*']
 * @constructor
@visiongeist
visiongeist / table-grid-accessibility-test.html
Last active April 25, 2019 12:41
Testing Accessibility of Table and ARIA role grid
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Table Accessibility</title>
<link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/github.min.css" rel="stylesheet">
<style id="grid-css">
/* make grid elements work like a table */
@visiongeist
visiongeist / requestanimationframe-for-jquery
Created August 30, 2012 08:24
requestAnimationFrame for jQuery animations
(function($, window, undefined) {
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
var lastTime = 0,
running,
animate = function (elem) {
@visiongeist
visiongeist / Function hook
Created August 20, 2012 08:16
This plugin hooks into an existing jQuery function and calls a user defined function after a jQuery function was called.
/*
* Function hook jQuery plugin
* version 1.0
* author: Damien Antipa
* http://github.com/dantipa/
*/
(function(window, $, undefined){
/**
* Hooks into a given method