Skip to content

Instantly share code, notes, and snippets.

View dbox's full-sized avatar

Daniel Box dbox

View GitHub Profile
/*
* Apple - apple.com
* SF Pro Display used on apple.com as of iPhone 7 (RED) launch (March 21st 2017)
usage:
- font-family: "SF Pro Display","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif;
- known issues:
- Access to Font at 'http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_bold.woff' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.
index.html:1 Access to Font at 'http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_bold.ttf' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.
@armornick
armornick / scut.styl
Created March 16, 2015 06:05
Translation of Scut to Stylus (https://davidtheclark.github.io/scut/)
/*
* Scut, a collection of Sass utilities
* to ease and improve our implementations of common style-code patterns.
* v1.1.2
* Docs at http://davidtheclark.github.io/scut
*
* Translated for Stylus by armornick
*/
scut-clearfix() {
@averyvery
averyvery / spread.sass
Last active May 16, 2020 22:07
spread.sass
// strip-units required by spread mixin
// http://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass
@function strip-units($number)
@return $number / ($number * 0 + 1)
// pow and sqrt required by ease function
// adapted from https://github.com/at-import/Sassy-math/blob/master/sass/math.scss
@function pow($base, $exponent)
$value: $base
@giuseppeg
giuseppeg / app-structure.md
Last active August 29, 2015 14:10
app front-end structure

Components (or modules) talk to each other via events.

  • vendor [3rd party scripts, this could as well be bower_components if you use bower]
  • core [app core functionalities/utilities]
  • component
    • component1
      • index.js [the actual js component]
      • spec.js [tests]
      • style.css [component styles]
  • index.partial.template
@zakirt
zakirt / siblings-by-count.scss
Last active July 25, 2017 09:33
Sass mixin for styling elements based on sibling count.
// -----------------------------------------------------------------------------
// @author Zakir Tariverdiev
// @created August 2, 2014
// @desc Sass mixin that provides convenient way to style element's siblings.
// Based on the example from Lea Verou's blog:
// http://lea.verou.me/2011/01/styling-children-based-on-their-number-with-css3/
// @param (string) $sibling-count - number of expected siblings. You can also use
// use such forms as "n + 3" and "3n" for "at least 3 siblings" and
// "siblings divisible by 3," for example. These forms must be enclosed in
// quotes for proer parsing though.
@Nemo64
Nemo64 / css-zoom.js
Last active February 6, 2024 14:28
A polyfill for the zoom css property in firefox. The element that is zoomed must not have a margin though!
// this is a hacky and brutal polyfill to somewhat implement zoom in firefox
// https://caniuse.com/#feat=css-zoom
// it allows to use jQuery's $('.element').css({zoom: 1.5});
// there is no effort to actually implement a normal css polyfill
// this polyfill also doesn't work when the zoomed element has margins since they are used to fake the new size.
$.cssNumber.zoom = true;
if (!("zoom" in document.body.style)) {
$.cssHooks.zoom = {
get: function(elem, computed, extra) {
@andrewlkho
andrewlkho / gist:10739376
Last active December 24, 2018 16:57
Clean URLs on jekyll/Apache

This was originally posted on 2011-07-11 to http://andrewho.co.uk/weblog/clean-urls-on-jekyll-apache

I use a static site generator, specifically [jekyll][], to transform some templates into a set of static *.html files. However, I like to keep the URLs looking clean, and not display the .html extension both because I think it looks better and also so that the URLs purely reflect the content and not the underlying files or CMS used to serve that content. In short, whilst the file being served might be $DOCUMENT_ROOT/weblog/title.html, the canonical URL for that resource should be /weblog/title. Here's how I do that in .htaccess.

@dbox
dbox / gist:8200937
Created December 31, 2013 19:05
Title Caps
/*
* Title Caps
*
* Ported to JavaScript By John Resig - http://ejohn.org/ - 21 May 2008
* Original by John Gruber - http://daringfireball.net/ - 10 May 2008
* License: http://www.opensource.org/licenses/mit-license.php
*/
(function(){
var small = "(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v[.]?|via|vs[.]?)";
@zspecza
zspecza / stylus-best-practices.md
Last active May 27, 2021 05:25
Stylus Best Practices

Stylus Best Practices

Introduction

This is a curated set of conventions and best practices for Stylus, an expressive, dynamic, robust and advanced CSS preprocessor. Frustrated with there not being a set of conventions set in place (that could be easily found), I set forth to find out on my own.

@millermedeiros
millermedeiros / osx_setup.md
Last active May 7, 2024 08:01
Mac OS X setup

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...