Skip to content

Instantly share code, notes, and snippets.

@didoo
didoo / git-log-parser.js
Created January 25, 2019 16:52
Git Log Parser & Aggregator
/* eslint-env node */
/* eslint-disable no-console, dot-notation */
const fse = require('fs-extra');
const readline = require('readline');
// const platform = 'mw_less';
// const platform = 'mw_scss';
const platform = 'cosmos';
@primaryobjects
primaryobjects / css-comparison.csv
Last active August 7, 2023 13:16
A comparison of CSS library sizes.
Name Version Size (uncompressed) Size (minified) Size (gzipped) URL
Bootstrap v3.3.7 143 KB 117 KB 20 KB http://getbootstrap.com/css/
Bootstrap v4.0.0 187 KB 147 KB 20 KB https://v4-alpha.getbootstrap.com/
Materialize v3.0 114 KB 90 KB 18 KB http://materializecss.com/
Material Design Lite v1.3.0 350 KB 137 KB 21 KB https://getmdl.io/
mini.css v2.1 47 KB 36 KB 7 KB https://chalarangelo.github.io/mini.css/
Semantic UI v2.2.6 730 KB 550 KB 95 KB https://semantic-ui.com/
Foundation v3.0 90 KB 64 KB 12 KB http://foundation.zurb.com/
Pure CSS v0.6.2 80 KB 17 KB 3.8 KB https://purecss.io/
Picnic CSS v6.3.2 55 KB 38 KB 7 KB https://picnicss.com
@jonlong
jonlong / cloudflare-purge-post-receive
Last active May 16, 2022 05:30
Purge CloudFlare when deploying GitHub Pages: post-receive hook
#!/bin/sh
#
# Purge the CloudFlare cache after pushing an update to GitHub Pages
#
# To use, rename this file to "post-receive" and drop it into the `.git/hooks/` directory in your project's root.
# Change the $branch value based on the type of page you're deploying.
# Use "master" for Organization Pages, and "gh-pages" for Project Pages.
#
# Find your CloudFlare API token here: https://www.cloudflare.com/a/account/my-account
@benedfit
benedfit / _critical.scss
Last active November 25, 2021 12:36
Critical CSS using Sass and Jekyll
$critical-css-only:true !default;
@mixin critical($critical-only:true){
@if (($critical-css-only and $critical-only) or (not $critical-css-only and not $critical-only)){
@content;
}
}
@haydenbleasel
haydenbleasel / transfade.js
Last active July 14, 2019 10:23
Medium-style vertical fading parallax scroll modifier for Stellar.js
// Custom transform and opacity modifier for Stellar.js
$.stellar.positionProperty.transfade = {
setPosition: function(element, newLeft, originalLeft, newTop, originalTop) {
var distance = newTop - originalTop;
var rate = $(window).height() / 5;
element.css('transform', 'translate3d(0, ' + distance + 'px, 0').css('opacity', 1 - (distance / rate));
}
};
@ttscoff
ttscoff / image_tag.rb
Created February 16, 2014 15:02
Custom Jekyll image tag with lazy loading and CDN changes
# Title: Simple Image tag for Jekyll
# Authors: Brandon Mathis http://brandonmathis.com
# Felix Schäfer, Frederic Hemberger
# Description: Easily output images with optional class names, width, height, title and alt attributes
#
# Syntax {% img [class name(s)] [http[s]:/]/path/to/image [width [height]] [title text | "title text" ["alt text"]] %}
#
# Examples:
# {% img /images/ninja.png Ninja Attack! %}
# {% img left half http://site.com/images/ninja.png Ninja Attack! %}
@zulfajuniadi
zulfajuniadi / jquery.connect.js
Last active November 22, 2017 16:44
jQuery Connect JS - A small script to make connections between two elements.
// jQuery Connect v0.0.1
// (c) Zulfa Juniadi <http://zulfait.blogspot.com/>
// Usage : var connection = $.connect('#elem1', '#elem2', {options});
// Documentation : http://zulfait.blogspot.com/2013/07/jquery-connect.html
// Source : https://gist.github.com/zulfajuniadi/5928559#file-jquery-connect-js
// Requires : jQuery v1.9+ (Older versions may work, but not tested)
// Suggests : jQuery UI (It works with draggable elements!)
// MIT License
;(function($) {
@morganestes
morganestes / WordPress get_the_ID() replacement.md
Last active May 16, 2021 21:15
Get the WordPress post ID no matter where you are.

This extends the built-in WordPress function get_the_ID() to return the post ID both inside and outside the loop.

Used outside the loop (in header.php):

<?php if ( function_exists( 'gt_hide_nav' ) && ! gt_hide_nav() ) : ?>
  <nav role="navigation">
    <?php if ( function_exists( 'bones_main_nav' ) ) bones_main_nav(); ?>
  </nav>
@cam-gists
cam-gists / canvas.js
Created August 20, 2012 15:49
JavaScript: Canvas Resize (Maintain Proportion)
/*==RESIZE CANVAS TO MAINTAIN PROPORTION ==*/
var fixDimensions = function(){
//Get the image dimensions:
var image = {
width: $("canvas").width(),
height: $("canvas").height()
};
//Get the page dimensions:
@Integralist
Integralist / remote-git.md
Created February 21, 2012 09:51
Basic set-up of remote git repository on a standard server

Set-up remote git repository on a standard server

The first thing to do is to install Git on the remote server.

Once you do that the rest of the process is split into three sections:

  1. Server set-up
  2. Local set-up (push commits)
  3. Server (pull commits)