Skip to content

Instantly share code, notes, and snippets.

@IainIsCreative
IainIsCreative / _baseline.scss
Created November 26, 2014 14:02
A very simple Baseline SCSS mixin for providing a visual baseline in your project, in CSS.
// Set up line-height and colour defaults for this mixin.
$line-height: 20px!default;
$line-color: #94d4ff!default;
/**
*
* Baseline Mixin
* Handy dandy mixin to provide a baseline for your typography.
*
* The mixin carries two arguments — the $baseline, which should match your line-height, and $baseline-color, the colour you want the lines to be.

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

@lunelson
lunelson / post.md
Last active October 27, 2016 22:18
The Self-Aware Sass Mixin

I did a talk the other night at Up Front Berlin about some use cases for features in Sass from the past year. The slides are here; but I wanted to publish some notes so this post is one part of those notes.

My talk focused on the map data-type, and specifically on combining maps with directives such as @content, @at-root, and unique-id() in interesting ways. One of these is a mixin design pattern that solves some problems with using @extendand placeholder (silent) selectors in Sass:

  1. having placeholder extensions appear somewhere way up in the top of your code, because that's where you imported them; and
  2. having to think about choosing @include vs. @extend in the first place.

This "self-aware" mixin works by creating (and extending) a placeholder selector for itself dynamically, the first time it is included, and uses a map to keep records of these includes, so when it is subsequently in

@othiym23
othiym23 / npm-upgrade-bleeding.sh
Created September 20, 2014 19:36
a safe way to upgrade all of your globally-installed npm packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
@apfelbox
apfelbox / Parser.php
Last active August 12, 2016 09:59
Adjusted parser to render paragraphs which only contain a single image without the paragraph. So instead <p><img ...></p> it just renders<img ...>
<?php
/**
* Adjusted parser to render paragraphs which only contain a single image without the paragraph.
*
* So instead
* <p><img ...></p>
*
* it just renders
* <img ...>
@neilgee
neilgee / git.css
Last active December 7, 2023 02:08
Git Command Line Reference - Notes, Cheatsheet and reminders on Git set up and commands
/*
* Set up your Git configuration
*/
git config --global user.email "you@yourdomain.com"
git config --global user.name "Your Name"
git config --global core.editor "nano"
@Cerdic
Cerdic / site-active-plugin.php
Last active December 18, 2015 21:38
Permet d'activer des plugins d'un site SPIP depuis la ligne de commande. Lancer le script depuis la racine du site ou depuis ecrire/ ou plugins/
#!/usr/bin/php
<?php
$activer = $argv;
array_shift($activer);
if (!is_dir('ecrire/') AND is_dir('../ecrire/')) chdir('../');
chdir('ecrire/');
if (!defined('_DIR_RESTREINT_ABS')) define('_DIR_RESTREINT_ABS', '');
@Cerdic
Cerdic / site-desactive-plugin.php
Last active December 18, 2015 21:38
Desactiver des plugins d'un site SPIP depuis la ligne de commande. Lancer le script depuis la racine du site SPIP, ou depuis le dossier ecrire/ ou le dossier plugins/
#!/usr/bin/php
<?php
$desactiver = $argv;
array_shift($desactiver);
if (!is_dir('ecrire/') AND is_dir('../ecrire/')) chdir('../');
chdir('ecrire/');
if (!defined('_DIR_RESTREINT_ABS')) define('_DIR_RESTREINT_ABS', '');
@robinnorth
robinnorth / wordpress_export-post-data.php
Created April 26, 2013 11:44
WordPress: Simple, configurable script to export post data to a CSV file
<?php
/**
* Export WordPress post data to CSV
* Based on <http://stackoverflow.com/a/3474698> and <http://ran.ge/2009/10/27/howto-create-stream-csv-php/>
*/
/**
*********************************************************************
* Configuration
*********************************************************************
@terkel
terkel / _decimal.scss
Last active November 23, 2023 18:36
Rounding decimals in Sass
// _decimal.scss | MIT License | gist.github.com/terkel/4373420
// Round a number to specified digits.
//
// @param {Number} $number A number to round
// @param {Number} [$digits:0] Digits to output
// @param {String} [$mode:round] (round|ceil|floor) How to round a number
// @return {Number} A rounded number
// @example
// decimal-round(0.333) => 0