Skip to content

Instantly share code, notes, and snippets.

View peterhry's full-sized avatar

Peter Hrynkow peterhry

View GitHub Profile
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 12, 2024 19:11
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@paulirish
paulirish / what-forces-layout.md
Last active May 12, 2024 13:20
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
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@kyledrake
kyledrake / ferengi-plan.txt
Last active April 6, 2024 00:30
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
@joshma
joshma / gist:9963528
Created April 3, 2014 21:45
chartbeat.js bug
Hi there,
We've been noticing errors coming from chartbeat.js: "Object #<SVGAnimatedString> has no method 'replace'" - I took a moment to diagnose the issue and found the error to arise when you click on an SVG node with an HREF attribute. It looks like there's a click handler for anchor tags that isn't aborting when the SVG node is clicked:
r.W = function(a) {
var b, c;
if (a = a || window.event) {
c = a.target || a.srcElement;
if (c.tagName !== "A")
if (c.parentNode)
@peterhry
peterhry / rad mixins
Created December 4, 2013 19:14
Some handy SCSS mixins
// Peter Hrynkow
// Grid mixin
[class*=span-] {
float: left;
position: relative;
}
@mixin grid ($name, $columns, $padding-x, $padding-y) {
$column-width: 100% / $columns;
@for $i from 1 through $columns {
.span-#{$name}-#{$i} {
@friggeri
friggeri / haiku
Created October 6, 2011 07:30
random heroku-like name generator
haiku = ->
adjs = [
"autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark",
"summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter",
"patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue",
"billowing", "broken", "cold", "damp", "falling", "frosty", "green",
"long", "late", "lingering", "bold", "little", "morning", "muddy", "old",
"red", "rough", "still", "small", "sparkling", "throbbing", "shy",
"wandering", "withered", "wild", "black", "young", "holy", "solitary",
"fragrant", "aged", "snowy", "proud", "floral", "restless", "divine",
@benjamine
benjamine / README.mdown
Created May 30, 2011 16:04 — forked from mathewbyrne/README.mdown
An asynchronous method for embedding gists in an HTML document using jQuery.

A quick jQuery plugin for asynchronously embedding a gist in an HTML document.

There are a couple of ways to use it. The simpler way is replacing all Gist links in document by their embedded version:

<script>$($.gist);</script>

All links that point to a gist, or gist file will be replaced by the corresponding embedded gist, or gist file.

Gist link replacement can also be called on a container element: