Skip to content

Instantly share code, notes, and snippets.

Dave Honneffer pearofducks

Block or report user

Report or block pearofducks

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pearofducks
pearofducks / mq.js
Created Jul 28, 2019
Svelte media-query readable stores
View mq.js
const setupMQ = (queryString) => (set) => {
const query = window.matchMedia(queryString)
const callback = (e) => set(e.matches)
query.addListener(callback)
callback(query)
return (query) => query.removeListener(callback)
}
// example use
View SketchSystems.spec
Partnerweb*
Home*
Providers -> Provider List
Provider List
Provider -> Provider
Provider
Contact Details
Edit Contact Details -> Edit Provider
Product Filter List -> Product Filters
Offer List -> Offer
@pearofducks
pearofducks / pretty-vue.sh
Last active Dec 19, 2017
Prettier script for Vue files
View pretty-vue.sh
#!/bin/bash
cd "$(dirname "$(readlink -f "$0")")"
SEDBIN="gsed"
command -v gsed >/dev/null 2>&1 || { SEDBIN="sed"; }
$SEDBIN --version >/dev/null 2>&1 || { echo >&2 "GNU-sed required but not installed. Maybe run: brew install gnu-sed"; exit 1; }
PROC="./node_modules/prettier/bin/prettier.js"
DIR="src/main/javascript"
@pearofducks
pearofducks / zepto.smoothScroll.js
Last active Sep 11, 2017 — forked from benjamincharity/zepto.smoothScroll.js
(Actual) smooth scrolling with Zepto.js - with easing
View zepto.smoothScroll.js
function easeInOutQuart( t ) {
const t1 = t - 1
return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * t1 * t1 * t1 * t1
}
function smoothScroll(el, to, duration) {
var initial = $(window).scrollTop()
var dest = to - initial
var start = null
function step (timestamp) {
if (!start) start = timestamp
View .vimrc
set nocp
call plug#begin('~/.vim/plugged')
Plug 'ctrlpvim/ctrlp.vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-haml', { 'for': 'haml' }
Plug 'tpope/vim-commentary'
Plug 'pearofducks/vim-mkdn', { 'for': 'markdown' }
@pearofducks
pearofducks / index.html
Created May 1, 2017
quick project goofing around with hljs and vue to make a color scheme
View index.html
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>schemer</title>
<style>
.circle { height: 10px; width: 10px; border-radius: 10px; margin-left: 5px; }
.color-control { display: flex; align-items: center;}
</style>
</head>
<body>
@pearofducks
pearofducks / setup_clt.sh
Created Mar 7, 2017
hands-off macOS command-line-tools install
View setup_clt.sh
if [[ $(/usr/bin/xcode-select -p &>/dev/null; /bin/echo $?) == 2 ]]; then
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
touch "$cmd_line_tools_temp_file"
cmd_line_tools=$(softwareupdate -l | awk '/\*\ Command Line Tools/ { $1=$1;print }' | tail -1 | sed 's/^[[ \t]]*//;s/[[ \t]]*$//;s/*//' | cut -c 2-)
softwareupdate -i "$cmd_line_tools" --verbose
if [[ $(/usr/bin/xcode-select -p &>/dev/null; /bin/echo $?) != 2 ]]; then
echo "CLT installed."
if [[ -f "$cmd_line_tools_temp_file" ]]; then
rm "$cmd_line_tools_temp_file"
fi
View gist:7e053fe6ad785c5290ca68ac3e23bcaf
class FooStore {
@observable foos = []
getFoos = () => {
return this.foos
}
getFoo = id => {
return this.foos.find(foo => foo.id === id)
}
@pearofducks
pearofducks / solarized_slack_colors.txt
Last active Jun 9, 2016
Actual solarized slack theme, instead of random solarized colors pasted in
View solarized_slack_colors.txt
#002b36,#073642,#268bd2,#eee8d5,#073642,#93a1a1,#859900,#cb4b16
You can set 'compact' view's chat colors by doing /color NAME HEXCODE
@pearofducks
pearofducks / webpack.config.js
Created May 29, 2016
right amount of logging
View webpack.config.js
var HtmlWebpackPlugin = require('html-webpack-plugin')
var HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: __dirname + '/app/index.html',
filename: 'index.html',
inject: 'body'
})
module.exports = {
devtool: 'cheap-module-eval-source-map',
devServer: {
You can’t perform that action at this time.