Skip to content

Instantly share code, notes, and snippets.

View tylersticka's full-sized avatar

Tyler Sticka tylersticka

View GitHub Profile
@stuntbox
stuntbox / gist:4557917
Last active March 23, 2023 03:32
Slightly smarter filtering to remove hard-coded width and height attributes from *all* images in WordPress (post thumbnails, images inserted into posts, and gravatars). Handy for responsive designs. Add the code below to the functions.php file in your theme's folder (/wp-content/themes/theme-name/ ). Remember to rename the function as needed to …
/**
* Filter out hard-coded width, height attributes on all images in WordPress.
* https://gist.github.com/4557917
*
* This version applies the function as a filter to the_content rather than send_to_editor.
* Changes made by filtering send_to_editor will be lost if you update the image or associated post
* and you will slowly lose your grip on sanity if you don't know to keep an eye out for it.
* the_content applies to the content of a post after it is retrieved from the database and is "theme-safe".
* (i.e., Your changes will not be stored permanently or impact the HTML output in other themes.)
*
@tsvensen
tsvensen / image-replacement.css
Last active December 23, 2019 11:46
Image Replacement Technique
/* http://www.zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement/ */
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
@yannickcr
yannickcr / set.js
Created June 5, 2013 09:41
Handlebars Set Helper: Capture a block of content and store it in a variable.
/*
* Usages:
* {{#set "content"}}
* captured content
* {{/set}}
* My {{ content }}
*/
Handlebars.registerHelper('set', function(name, options) {
this[name] = options.fn(this);
return null;
@markgoodyear
markgoodyear / gist:9100177
Last active August 29, 2015 13:56
Example of a dev flag for gulp
// Define your plugins here, make sure you have `gulp-util`...
var gutil = require('gulp-util');
/**
* Define dev CLI flag
* Run `gulp --dev`
*/
var isDev = gutil.env.dev;
gulp.task('scripts', function() {
@bjhomer
bjhomer / gist:9393869
Last active July 7, 2021 20:26
Starting and stopping VoiceOver from the terminal
//The very slow, but more semantically correct way
osascript -e 'tell application "VoiceOver" to activate'
osascript -e 'tell application "VoiceOver" to quit'
// The really fast way. (96 is the keycode for F5.)
osascript -e 'tell application "System Events" to key code 96 using command down'
@lyzadanger
lyzadanger / gulp-template-through2.js
Last active August 29, 2015 14:11
Template for gulp plugin using through2
var through = require('through2');
var gutil = require('gulp-util');
// Anything in this scope will execute once on `require`
module.exports = function thisIsMyGulpPlugin() {
// Do some stuff here if you want
// Anything at this scope level will execute once per
// task-level stream (i.e. every time a task is invoked
// and the stream piped through this plugin)
@danharper
danharper / gulpfile.js
Last active September 25, 2024 09:04
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@paulirish
paulirish / what-forces-layout.md
Last active May 8, 2025 05:49
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@erikcox
erikcox / SimCityLoadingMessages.txt
Created November 11, 2015 21:23
A list of loading messages from the game SimCity, which I repurposed for Slack loading messages.
Adding Hidden Agendas
Adjusting Bell Curves
Aesthesizing Industrial Areas
Aligning Covariance Matrices
Applying Feng Shui Shaders
Applying Theatre Soda Layer
Asserting Packed Exemplars
Attempting to Lock Back-Buffer
Binding Sapling Root System
Breeding Fauna
@ayamflow
ayamflow / gist:b602ab436ac9f05660d9c15190f4fd7b
Created May 9, 2016 19:10
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);