Skip to content

Instantly share code, notes, and snippets.


Mark Otto mdo

View GitHub Profile
#!/usr/bin/env sh
set -e
echo "Fetching fonts from Apple..."
curl -o /tmp/SF-Font.dmg
hdiutil attach -nobrowse -quiet -noverify -noautoopen -mountpoint /Volumes/SF-Font /tmp/SF-Font.dmg
echo "Installing fonts..."
cp -R /Volumes/SF-Font/. /Library/Fonts/
nternetinspired / output-articles-by-collection.liquid
Last active Apr 25, 2021
Loop through Jekyll collections and output their content as sections and articles
View output-articles-by-collection.liquid
{% comment %}
Loops though every collection you defined in _config.yml and grabs the pages they contain; outputting title and full text with good basic html semantics.
Use page.excerpt instead of page.content to grab the first paragraph, blog list style. Markdownify is optional, depends how you authored content in your collections; I typically use Markdown.
{% endcomment % }
{% for collection in site.collections %}
{% assign name = collection.label %}
DarrenN / get-npm-package-version
Last active Jan 3, 2022 — forked from yvele/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
View get-npm-package-version
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
addyosmani / package.json
Last active Nov 25, 2021
npm run-scripts boilerplate
View package.json
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
View Dribbble first 5k users.
1: Dan Cederholm was created on 2009/07/07 21:51:22 -0400.
2: Rich Thornett was created on 2009/07/07 21:51:50 -0400.
3: Meagan Fisher was created on 2009/07/21 19:32:24 -0400.
4: Ethan Marcotte was created on 2009/07/31 11:24:18 -0400.
5: Joshua Porter was created on 2009/08/04 17:07:24 -0400.
6: Adam Darowski was created on 2009/08/05 18:36:03 -0400.
7: Cindy Li was created on 2009/08/06 09:12:08 -0400.
8: Greg Storey was created on 2009/08/06 10:06:37 -0400.
9: Ryan Irelan was created on 2009/08/06 21:01:36 -0400.
10: Cameron Moll was created on 2009/08/06 22:25:36 -0400.
nicolashery /
Last active Oct 1, 2021
Make environment variables available in Jekyll Liquid templates

Environment variables in Jekyll templates

This is one way to pass some data (API tokens, etc.) to your Jekyll templates without putting it in your _config.yml file (which is likely to be committed in your GitHub repository).

Copy the environment_variables.rb plugin to your _plugins folder, and add any environment variable you wish to have available on the site.config object.

In a Liquid template, that information will be available through the site object. For example, _layouts/default.html could contain:

dannykeane / output.css
Created Feb 11, 2013
Less CSS Retina Mixin
View output.css
background-image: url('/images/sprite.png');
background-repeat: no-repeat;
background-position: -3px 0;
@media print, screen,
(-webkit-min-device-pixel-ratio: 1.25),
(~`"-o-min-device-pixel-ratio: 1.25/1"`),
(min--moz-device-pixel-ratio: 1.25),
View entypo.css
@font-face {
font-family: 'EntypoRegular';
src: url('font/entypo.eot');
src: url('font/entypo.eot?#iefix') format('embedded-opentype'),
url('font/entypo.woff') format('woff'),
url('font/entypo.ttf') format('truetype'),
url('font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
nrrrdcore / list.css
Created Aug 20, 2012
Simple Fix for the Webkit Clipped Border-Radius Bug
View list.css
.list-container {
border-radius: 5px;
border: 1px solid #C5C5C5;
box-shadow: inset 0 1px 0 #FFF;
ol {
border: 1px solid transparent;
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: