Skip to content

Instantly share code, notes, and snippets.

View argyleink's full-sized avatar
💀
calc(dev*design)

Adam Argyle argyleink

💀
calc(dev*design)
View GitHub Profile
@argyleink
argyleink / custom.element.js
Last active September 12, 2022 12:00
custom element with shadow dom
export default class CustomElement extends HTMLElement {
constructor() {
super()
this.$shadow = this.attachShadow()
this.$shadow.innerHTML = this.render()
}
connectedCallback() {}
disconnectedCallback() {}
@argyleink
argyleink / notify.js
Created March 12, 2015 20:21
HTML5 Notifications module
app.notify = (function() {
// Determine the correct object to use
var notification = window.Notification || window.mozNotification || window.webkitNotification || false
, permission = false
, note;
function init() {
notification && notification.requestPermission(permissionSuccess);
}
@argyleink
argyleink / vh-fix.js
Created February 14, 2016 21:57
Fix mobile layout thrashing from using VH's
var els = document.querySelectorAll('.vh-fix')
if (!els.length) return
for (var i = 0; i < els.length; i++) {
var el = els[i]
if (el.nodeName === 'IMG') {
el.onload = function() {
this.style.height = this.clientHeight + 'px'
}
} else {
@argyleink
argyleink / conic.example.css
Last active January 14, 2022 04:14
demo conic
div {
background: conic-gradient(at top right, deeppink, rebeccapurple);
}
@argyleink
argyleink / caption-color-hint.css
Created March 2, 2021 06:24
CSS gradient <color-hint> or <transition-hint> example
figcaption {
background: linear-gradient(to top,
hsla(0 0% 0% / 90%),
75%, /* <color-hint> */
hsla(0 0% 0% / 0)
);
}
@argyleink
argyleink / dabblet.css
Created March 19, 2012 05:29
Pure CSS3 Accordion System inspired by the CSS Ninja
/*
Pure CSS3 Accordion System inspired by the CSS Ninja
*/
body{ font-family:sans-serif; background:#f9f9f9; }
dl {
padding: 10px;
}
/* HSL's 50% lightness */
/* middle grey */
hsl(0 0% 50%)
lab(53.39% 0 -0.01)
/* 3.94:1 ❌ */
/* lime */
hsl(100 100% 50%)
lab(88.66% -77.99 84.31)
main {
/* writing mode contextual shorthand for border-top and border-bottom respectively */
border-block: 1px solid hotpink;
/* writing mode contextual shorthand for border-left and border-right respectively */
border-inline: 1px solid hotpink;
}
@argyleink
argyleink / css&js.css
Created December 26, 2018 23:02
css and js doing similar tasks
foo {
color: hsl(100,80%,75%);
background-color: hsl(100,20%,25%);
}
foo.map(styles => ({
...styles,
color: 'hsl(100,80%,75%)',
background-color: 'hsl(100,20%,25%)',
}))
@argyleink
argyleink / blingbling.js
Last active May 19, 2018 01:04 — forked from paulirish/bling.js
add some sugar to bling dot js
const sugar = {
on: function(names, fn) {
names
.split(' ')
.forEach(name =>
this.addEventListener(name, fn))
},
setAttributes: function(attrs) {
Object.entries(attrs)
.forEach(([key, val]) =>