Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Making Luro

Dave Rupert davatron5000

🚀
Making Luro
View GitHub Profile
@davatron5000
davatron5000 / gist:2254924
Created March 30, 2012 20:57
Static Site Generators
View gist:2254924

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

View slack-transcripts.js
const arr = $$('.p-media_transcript__scrollable > p').map((line) => {
return {
timestamp: line.querySelector('.p-media_transcript__timestamp').textContent,
text: line.querySelector('.p-media_transcript__text').textContent
}
});
function hhmmssToMillis(hhmmss) {
const time = hhmmss.split(':').reverse();
switch(time.length) {
@davatron5000
davatron5000 / webperformant.htaccess
Created June 6, 2010 18:23
An .htaccess file for web performance and passing Page Speed and YSlow rules
View webperformant.htaccess
# Enable GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</ifmodule>
# Expires Headers - 2678400s = 31 days
<ifmodule mod_expires.c>
View vanilla-fitvids.js
// Vanilla version of FitVids
// Still licencened under WTFPL
//
// Not as robust and fault tolerant as the jQuery version.
// It's BYOCSS.
// And also, I don't support this at all whatsoever.
;(function(window, document, undefined) {
'use strict';
View book.yml
# - title:
# subtitle:
# author:
# img: https://images-na.ssl-images-amazon.com/images/P/#.01._SCLZZZZZZZ_.jpg
# url:
# rating:
# notes:
- year: 2018
books:
- title: Showa 1953-1989
@davatron5000
davatron5000 / gist:1665812
Created January 23, 2012 22:15
WordPress Remove Widget Titles
View gist:1665812
<?php
// Register widgetized sidebar.
register_sidebar(array(
// See: http://codex.wordpress.org/Function_Reference/register_sidebar
'before_title' => '',
'after_title' => ''
));
add_filter( 'widget_title', 'remove_widget_titles');
function remove_widget_titles( $widget_title ) {
@davatron5000
davatron5000 / Sublime Text Setup.md
Last active June 15, 2022 17:42
A new user's guide to SublimeText 2. Estimated reading time: 2 mins. Estimated workthrough time: 12 minutes.
View Sublime Text Setup.md

Make it useful

  • Install Package Control. For SublimeText 2, paste the following in Terminal:
import urllib2,os; pf='Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), 'wb' ).write( urllib2.urlopen( 'http://sublime.wbond.net/' +pf.replace( ' ','%20' )).read()); print( 'Please restart Sublime Text to finish installation')

From here on out, use Package Control to install everything. +Shift+P, then type Install to get a list of installable packages you can 'livesearch through. After installing plugins, they should be running.

@davatron5000
davatron5000 / the-state-of-element-container-queries.md
Last active December 2, 2021 11:51
The State of Element/Container Queries
View the-state-of-element-container-queries.md

The State of Container Queries

tl;dr Developers would like the idea to style components based on a parent's width rather than depend solely on the viewport media query. This would allow modular components to style themselves while being agnostic to the viewport.

There is currently a lot of developer interest in getting a feature like Container Queries (née "Element Queryies") shipped in a browser.

2-min Catchup

Here are official'ish documents to outline the developer community's desires.

@davatron5000
davatron5000 / popup.css
Last active September 19, 2021 01:42
Universal Popup Control
View popup.css
[aria-hidden="true"] { display: none; }
View budgets.json
[
{
"path": "/*",
"resourceSizes": [
{"resourceType": "script","budget": 350},
{"resourceType": "total","budget": 450}
]
}
]