Skip to content

Instantly share code, notes, and snippets.

View axelav's full-sized avatar
🕸️

Axel Anderson axelav

🕸️
View GitHub Profile
@axelav
axelav / 55-bytes-of-css.md
Created September 27, 2022 09:43 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@axelav
axelav / localStorage-polyfill.js
Last active January 23, 2018 00:14 — forked from juliocesar/best-localStorage-polyfill-evar.js
This is the best localStorage polyfill in the world
if (!('localStorage' in window)) {
window.localStorage = {
_data : {},
setItem : function(id, val) { return this._data[id] = String(val); },
getItem : function(id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; },
removeItem : function(id) { return delete this._data[id]; },
clear : function() { return this._data = {}; }
};
}
# requires ~/.aws/config or $ aws configure to work
alias inst="aws ec2 describe-instances --output text|grep INSTANCES|cut -f10,14"
@axelav
axelav / type.js
Created June 15, 2016 20:00 — forked from kirilloid/type.js
getType
function getType (value) {
let type = typeof value;
if (type === 'object') {
return value ? Object.prototype.toString.call(value).slice(8, -1) : 'null';
}
return type;
}
[NaN, 0, 1, Infinity, // numbers
null, undefined, false, 'str', // other primitives
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body ng-app="APP">
<div ng-controller="ctrl">
<div scope-test
@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

/**
* This file/module contains all configuration for the build process.
*/
/**
* Load requires and directory resources
*/
var join = require('path').join,
bowerrc = JSON.parse(require('fs').readFileSync('./.bowerrc', {encoding: 'utf8'})),
bowerJSON = bowerrc.json.replace(/^\.?\/?/, './'),
@axelav
axelav / scrollspy.coffee
Last active January 4, 2016 15:18 — forked from alxhill/scrollspy.coffee
add smooth scrolling (lines 11-18) & allow nested lists of spies
angular.module('directives.scrollSpy', [])
.directive('spy', ($location) ->
restrict: 'A'
require: '^scrollSpy'
link: (scope, elem, attrs, scrollSpy) ->
attrs.spyClass ?= 'active'
elem.click (e) ->
e.stopPropagation()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Building a router</title>
<script>
// Put John's template engine code here...
(function () {
// A hash to store our routes:

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname