Skip to content

Instantly share code, notes, and snippets.

View axelav's full-sized avatar
🕸️

Axel Anderson axelav

🕸️
View GitHub Profile
var ie = (function(){
// for-loop saves characters over while
for( var v = 3,
// b just as good as a div with 2 fewer characters
el = document.createElement('b'),
// el.all instead of el.getElementsByTagName('i')
// empty array as loop breaker (and exception-avoider) for non-IE and IE10+
all = el.all || [];
// i tag not well-formed since we know that IE5-IE9 won't mind
el.innerHTML = '<!--[if gt IE ' + (++v) + ']><i><![endif]-->',
.tomorrow-night {
color: #c5c8c6;
background-color: #1d1f21;
}
.tomorrow-night .red {
color: #cc6666; /* red */
}
.tomorrow-night .orange {

js dom techniques

via weaning yourself off jquery

selecting elements

// get a single element
document.querySelector('.foo .bar')
element.querySelector('.bar')
RegExp.email = /\b([\w\-.%+]+@(?:[\w\-]+\.)+[A-Z]{2,})\b/i;
// /\b
// (?:
// https?:\/\/| # URL protocol and colon
// www\d{0,3}[.]| # or www.
// [a-z0-9.\-]+[.][a-z]{2,}\/ # or url like thing followed by a slash
// )
// (?:
// [^\s()<>]+| # Run of non-space, non-()<>{}[]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Loading Container</title>
<!--REF: http://cloudcannon.com/deconstructions/2014/11/15/facebook-content-placeholder-deconstruction.html-->
<style>
@axelav
axelav / README.md
Last active August 29, 2015 14:07 — forked from addyosmani/README.md

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

COMPARE SCREENSHOTS AT DIFFERENT RESOLUTIONS

GOAL

Run a single command that:

  1. captures images of site at defined resolutions
  2. visually compares those images with previous results
  3. alerts if changes are detected

HEADLESS RASPBERRY PI SETUP WITH OS X

Creating a disk image:

http://txfx.net/2012/12/05/raspberry-pi-headless-setup/

$ sudo diskutil unmount /dev/disk1s1
$ sudo dd bs=1M if=/Users/axelav/Downloads/rpi.img of=/dev/rdisk1 # NOTE: `disk1s1` becomes `rdisk1` DONT FUCK THIS UP
$ sudo diskutil eject /dev/rdisk1
/*-----------\
* COMMENTS *
\-----------*/