Skip to content

Instantly share code, notes, and snippets.

const fs = require('fs');
const d3 = require('d3-dsv');
const path = require('path');
const yaml = require('js-yaml');
const toMarkdown = require('to-markdown');
d3.csvParse(
fs.readFileSync('./goodreads_library_export.csv', 'utf8')
).filter(row => {
return row['Exclusive Shelf'] !== 'to-read';
@opattison
opattison / 2016-02-13-example.md
Last active April 25, 2016 20:34
Jekyll srcset imgix implementation with include file, srcset/sizes in config, YAML-provided images, and temporarily assigned variables
title image
example srcset implementation
src alt
/images/example.jpg
Don’t forget alt text.

{% assign image = page.image[0] %} {% include srcset.html %}

@mrmrs
mrmrs / github-display-none.css
Last active November 2, 2019 03:09
Single purpose rulesets to set an element to display none from githubs production css
.table-list-triage {
display: none;
}
.triage-mode .table-list-non-triage, .triage-mode .table-list-filters {
display: none;
}
.boxed-group-list>li.approved .btn-sm, .boxed-group-list>li.rejected .btn-sm {
display: none;
}
.repo-list .participation-graph.disabled {
@tmcw
tmcw / code_style.md
Last active June 3, 2016 19:06
On Code Style

You might be expecting a long rant on why code style matters and tabs are sinful in your JavaScript code. This isn't that, thankfully.

If you've been snooping around ★★REDACTED★★★, you may have noticed that, in contrast to our other projects, it uses 2 spaces for indentation instead of 4. This was a decision Eden, Lauren, and I made, given that we kind of just started out that way, and that two-tab indentation makes our somewhat absurd functional chains easier on the eyes and the widths.

This also allows us to say that we simply use the Airbnb code style rather than saying we use it with a carveout as we've written for mapbox.js and iD.

This isn't an announcement that we're switching to 2 spaces, but rather a statement of how we treat code style and deal with these differences:

Use one code style for your whole project, and be consistent

What kind of iteration to use when in JavaScript

For loops

for (var i = 0; i < array.length; i++) {
}
  • Code has to run in old versions of IE.
@scottjehl
scottjehl / noncritcss.md
Last active August 12, 2023 16:57
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

<div>
<label for="sort-by">Sort by</label>
<select id="sort-by">
<option value="manual">Featured</option>
<option value="price-ascending">Price: Low to High</option>
<option value="price-descending">Price: High to Low</option>
<option value="title-ascending">A-Z</option>
<option value="title-descending">Z-A</option>
<option value="created-ascending">Oldest to Newest</option>
<option value="created-descending">Newest to Oldest</option>
@adactio
adactio / postforms.js
Created March 2, 2014 23:42
Show a progress bar when a form is submitted (and prevent more than one submission per document).
/*
Show a progress element for any form submission via POST.
Prevent the form element from being submitted twice.
*/
(function (win, doc) {
'use strict';
if (!doc.querySelectorAll || !win.addEventListener) {
// doesn't cut the mustard.
return;
}
@qguv
qguv / solarized-dark.css
Last active April 5, 2021 04:50 — forked from nicolashery/solarized-dark.css
Solarized theme for Jekyll, updated to reflect toned-down line numbers
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content