Skip to content

Instantly share code, notes, and snippets.

@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
@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

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

@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.
// Photoshop Script to Create iPhone Icons from iTunesArtwork
// Original: https://gist.github.com/appsbynight/3681050
// Turn debugger on. 0 is off.
// $.level = 1;
try
{
// Prompt user to select iTunesArtwork file. Clicking "Cancel" returns null.
var iTunesArtwork = File.openDialog("Select a sqaure PNG file that is at least 1024x1024.", "*.png", false);
@ryantbrown
ryantbrown / gulp-resize-and-minify-images.js
Last active August 30, 2022 14:07
Gulp - Resize and Optimize / Minify Images
/**
* Make sure Graphicsmagick is installed on your system
* osx: brew install graphicsmagick
* ubuntu: apt-get install graphicsmagick
*
* Install these gulp plugins
* glup, gulp-image-resize, gulp-imagemin and imagemin-pngquant
*
* Group images according to their output dimensions.
* (ex: place all portfolio images into "images/portfolio"

1. Create a folder in Dropbox or Google Drive

We'll use ~/Dropbox/Macnotes in this example

2. Copy the notes folder to the new folder in Dropbox or Google Drive

We'll use Finder for this instead of terminal as the cp -r command also copies the contents of all aliases and the Notes folder has a lot of those. Quit notes Open terminal and enable hidden files in Finder:

defaults write com.apple.finder AppleShowAllFiles YES.
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active June 10, 2024 19:57
Vanilla JavaScript Quick Reference / Cheatsheet
@kevinpapst
kevinpapst / osx-10.11-setup.md
Last active April 28, 2024 05:26 — forked from kevinelliott/osx-10.11-setup.md
Mac OS X 10.11 El Capitan Setup

Developer setup for Mac OS X 10.11 El Capitan

Inspired by a Gist from kevinelliott - thanks!

Software

Install from App Store

  • Xcode - for command line tools required by Homebrew
@brunob
brunob / cleanrss.html
Last active February 8, 2017 18:07
Un squelette SPIP qui prend l'url d'un flux RSS non valide en paramètre pour renvoyer le flux au propre. Pratique pour syndiquer certains flux WordPress (odgprod par exemple) dans Nextcoud. https://seenthis.net/messages/568088
#CACHE{0}
[(#HTTP_HEADER{Content-type: text/xml[; charset=(#CHARSET)]})]<?xml
version="1.0"[ encoding="(#CHARSET)"]?>
<rss version="2.0" [(#REM) rss 2.0.9)]
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
>
[(#SET{channel,#ENV{url}|analyser_site})]
<channel[ xml:lang="(#LANG)"]>
[<title>(#GET{channel}|table_valeur{nom_site}|textebrut|texte_backend)</title>]