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 / ice-reveal.module.js
Last active May 7, 2018 21:24
simple, safe, compose-able, testable logic container
const module = (deps) => {
const actuallyPrivate = 'foo'
return Object.freeze({
interface
})
const interface = () =>
console.log(deps, actuallyPrivate)
}
@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]) =>
@argyleink
argyleink / easings.css
Created February 26, 2018 22:34
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
@argyleink
argyleink / history.coffee
Created November 26, 2017 21:46
my code history
history = [
1999: 'VRML'
2000: 'HTML'
2000: 'CSS'
2000: 'JavaScript'
2000: 'XML'
2005: 'ActionScript2'
2007: 'Java'
2007: 'PHP'
2007: 'MySQL'
@argyleink
argyleink / likes.rxjs.ts.js
Created January 6, 2017 22:14
There an easier way? RXJS subject to increment likes on an array object
// this really what it takes to increment a counter on an item in my observable
// likes is a subject, broadcasting the updated array eventually to the source observable being rendered
this.likes
.map(
(message: Message): IMessagesOperation =>
(messages: Message[]) => {
return messages.map((m: Message) => {
// todo: check if user has already liked
if (m.id == message.id)
++m.likes
const el = function(options) {
let node = document.createElement(options.type || 'div')
if (options.id) node.id = options.id
if (options.class) node.className = options.class
if (options.text) node.textContent = options.text
if (options.html) node.innerHTML = options.html
return node
}
@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 / 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 / gzip.conf
Created July 17, 2014 21:17
Nginx gzip
# save to /etc/nginx/conf.d/gzip.conf
gzip on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript;
gzip_vary on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-slider/paper-slider.html">
<link rel="import" href="../paper-toggle-button/paper-toggle-button.html">