Skip to content

Instantly share code, notes, and snippets.

View roman0x58's full-sized avatar
πŸ„β€β™‚οΈ

Belikin Roman roman0x58

πŸ„β€β™‚οΈ
View GitHub Profile
@odoe
odoe / vector-tile-pr.md
Last active December 27, 2024 08:40
Indexing of Vector Tiles (Clipping Justification)

Indexing of Vector Tiles (Clipping Justification)

This pull-request provides the ability to display vector tile trees containing leaves at different levels of detail (LOD) based on data density. This requires clipping tiles when zoomed in beyond a physically present leaf and using an index to determine tile presence.

Purpose

The goal is to efficiently cook tiles and still maintain a high level of data precision in vector tiles. We can achieve this by limiting the cooking of tiles to a satisfactory LOD in less geometrically dense areas. On the consumer side, clipping can be used to clip larger tiles to fit a more precise LOD as needed. This methodology also provides over-zooming of tiles beyond the LOD limit of the current Vector Tile specification.

@paulirish
paulirish / what-forces-layout.md
Last active April 8, 2025 12:26
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
@gakuzzzz
gakuzzzz / enumerator_to_is.scala
Last active December 30, 2015 10:20
Enumerator to InputStream
val enumerator: Enumerator[Array[Byte]] = ...
val pos = new PipedOutputStream()
val pis = new PipedInputStream(pos)
Future { useInputStream(pis) }
val it = Iteratee.foreach(pos.write)
enumerator.onDoneEnumerating(pos.close()) |>>> it
@gigiigig
gigiigig / auxpattern.scala
Last active January 8, 2025 00:31
Aux Pattern
import shapeless._
import scalaz._
import Scalaz._
object console extends App {
trait Foo[A] {
type B
def value: B
@mulhoon
mulhoon / Highcharts Cheat Sheet
Last active March 22, 2023 18:43
Highcharts Cheat Sheet
$('#container').highcharts({
chart: {
alignTicks: true, // When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks.
animation: true, // Set the overall animation for all chart updating. Animation can be disabled throughout the chart by setting it to false here.
backgroundColor: '#FFF', // The background color or gradient for the outer chart area.
borderColor: '#4572A7', // The color of the outer chart border.
borderRadius: 5, // The corner radius of the outer chart border. In export, the radius defaults to 0. Defaults to 5.
borderWidth: 0, // The pixel width of the outer chart border.
className: null, // A CSS class name to apply to the charts container div, allowing unique CSS styling for each chart.
defaultSeriesType: 'line', // Alias of type.
@StevenLangbroek
StevenLangbroek / 00_decorators.js
Last active September 20, 2016 08:22
Backbone with decorators (warning: untested) *update*: corrections from Ben applied.
import _ from 'underscore';
export function on(eventName){
return function(target, name, descriptor){
if(!target.events) {
target.events = {};
}
if(_.isFunction(target.events)) {
throw new Error('The on decorator is not compatible with an events method');
return;
@Fishrock123
Fishrock123 / gulp.js
Last active August 1, 2021 11:19
gulp & browserify (+watchify +babelify)
var gulp = require('gulp')
var browserify = require('browserify')
var watchify = require('watchify')
var babelify = require('babelify')
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var merge = require('utils-merge')
@barneycarroll
barneycarroll / occluder.js
Created March 19, 2015 11:12
Occlusion culling in Mithril
function occluder(){
var fresh = true;
var item = 40;
var offset = 0;
var scroller = window;
var viewport = 0;
return {
scroller : function scrollerConfig( el, init, context ){
if( arguments.length < 2 || !init || fresh ){
@sebmarkbage
sebmarkbage / Enhance.js
Last active February 10, 2025 06:23
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@austinhyde
austinhyde / js-observables-binding.md
Last active January 7, 2025 08:27
Vanilla JavaScript Data Binding

Observables

You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5

setN(10);