Skip to content

Instantly share code, notes, and snippets.

@andrew--r
andrew--r / templating_problems.MD
Last active October 24, 2019 17:55 — forked from mpj/templating_problems.MD
Критика шаблонизаторов

Оригинальная заметка Матиаса Питера Йохансона, переведена с разрешения автора.


Размышления о языках шаблонов

Меня часто спрашивают, что я думаю о Vue.

Не буду оценивать Vue, так как я недостаточно хорошо знаком с ней, но я очень хорошо знаком с шаблонизаторами. Собственная система шаблонов Vue вместо JSX во многих статьях преподносится как причина, по которой вы должны выбрать Vue. Из-за этого я на стену лезу от негодования, потому что негативные стороны этого подхода даже не удостаиваются упоминания или обсуждения. JSX существует по достаточно веским причинам. Для меня JSX — большой шаг к упрощению и улучшению шаблонов.

@jakub-g
jakub-g / _1_"script async defer" blocks "load" event.md
Last active August 22, 2023 10:10
Beware of "script async defer" blocking HTML "load" event

Beware of <script async defer> blocking HTML "load" event

2015.10.07 t

On the importance of simulated latency testing, and bulletproofing your page from the third-party JS load failures

TL;DR

@paulirish
paulirish / what-forces-layout.md
Last active July 23, 2024 15:12
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
@msaharov
msaharov / rev.sh
Last active August 29, 2015 14:16
rev.txt creator
#!/usr/bin/env bash
# --------------------------------------------------------------------------- # # Functions # --------------------------------------------------------------------------- # # git repository info (like svn info) function info() {
#[ -z ${1} ] && fail "${FUNCNAME}: REPOSITORY DIR not set" 1
#pushd ${1} >/dev/null
# Find base of git directory
#while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done
# Show various information about this git directory
if [ -d .git ]; then
@tommaitland
tommaitland / ng-debounce.js
Last active November 9, 2018 02:17
Debounce/Throttling Directive for Angular JS 1.2+
angular.module('app', []).directive('ngDebounce', function($timeout) {
return {
restrict: 'A',
require: 'ngModel',
priority: 99,
link: function(scope, elm, attr, ngModelCtrl) {
if (attr.type === 'radio' || attr.type === 'checkbox') return;
elm.unbind('input');
@jdkanani
jdkanani / notepad.html
Last active June 16, 2024 13:44 — forked from jakeonrails/Ruby Notepad Bookmarklet
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`
@atk
atk / ie10hack.css
Created November 6, 2012 14:43
IE10 hack
/*
#ie10 will only be red in MSIE 10,
both in high contrast (display setting) and default mode
*/
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
#ie10 { color: red; }
}
@eirikbacker
eirikbacker / addEventListener-polyfill.js
Created June 3, 2012 19:30
addEventListener polyfill for IE6+
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence
(function(win, doc){
if(win.addEventListener)return; //No need to polyfill
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}}
function addEvent(on, fn, self){
return (self = this).attachEvent('on' + on, function(e){
var e = e || win.event;
e.preventDefault = e.preventDefault || function(){e.returnValue = false}
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true}
@fomigo
fomigo / defaultTemplateByParentTv.plugin.php
Created April 9, 2012 15:37 — forked from bfncs/defaultTemplateByParentTv.plugin.php
Default Children Template by Parent TV - modX Revolution Plugin
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
@itrelease
itrelease / calc-scrollbar-width.js
Created October 25, 2011 14:10
Calculate scrollbar width
/*
.scrollbar-measure {
width: 100px;
height: 100px;
overflow: scroll;
position: absolute;
top: -9999px;
}
*/
// Create the measurement node