Skip to content

Instantly share code, notes, and snippets.

View charliepark's full-sized avatar
🚀

Charlie Park charliepark

🚀
View GitHub Profile

This gist is a simple no-brainer description of the 3 ways (actually 2.5) the Web handle events.

<tag onclick />

The declarative inline HTML event listener is mostly an indirection of DOM Level 0 events, meaning this simply uses the equivalent of tag.onclick = listener behind the scene.

Example

click me
@scottjehl
scottjehl / noncritcss.md
Last active August 12, 2023 16:57
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@charliepark
charliepark / simple_breakpoints.css
Created September 9, 2013 17:54
simple responsive breakpoints
/* via http://stackoverflow.com/questions/16443380/common-css-media-queries-break-points */
@media only screen and (min-width: 768px) {
/* tablets and desktop */
}
@media only screen and (max-width: 767px) {
/* phones */
}
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
Do What You Want
Those are the most frightening four words brought to us by the connection revolution.
If you want to sing, sing.
If you want to lead, lead.
If you want to touch, connect, describe, disrupt, give, support, build, question... do it.
You will not be picked.
But if you want to pick yourself, go for it.
The cost is that you own the results
@nrrrdcore
nrrrdcore / retina_bg.css
Created November 15, 2012 06:50
Retina-Ready Background Swatching (Minus the Bullshit)
background-image: url('../images/greyfloral_@2X.png');
background-size: 150px 124px; /* size in px of image @1X */
@danro
danro / Custom.css
Created September 16, 2012 17:32
Improved webkit inspector toolbar
#-webkit-web-inspector #toolbar {
background: #cdcdcd !important;
height: 36px !important;
}
#-webkit-web-inspector #main {
top: 36px !important;
}
#-webkit-web-inspector .toolbar-item.elements:hover:after {
content: "elements";
z-index: 9999;
@joshwand
joshwand / gist:1074244
Created July 10, 2011 03:53
How to fix "libiconv is missing" problem installing Nokogiri on 10.6 with MacPorts

When installing Nokogiri on 10.6 with macports, the build fails because libiconv is missing:


Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
       ERROR: Failed to build gem native extension.

/Users/jmacdonald/.rvm/rubies/ruby-1.8.7-p174/bin/ruby extconf.rb
checking for libxml/parser.h... yes
@founddrama
founddrama / one-liner-array-sorts.js
Created February 11, 2011 15:06
Enough with the `if (a > b) { } else if (a < b) { } else { }` stuff, OK? If you've got numbers, you can sort with a one-liner as follows...
var arr = [10, 5, 6, 1, -2, 28];
function ascending(a, b){
return ( (a - b) / Math.abs(a - b) ) || 0;
}
function descending(a, b){
return ( (b - a) / Math.abs(b - a) ) || 0;
}