Skip to content

Instantly share code, notes, and snippets.

thinkin' about them websites

Alex Jegtnes jegtnes

thinkin' about them websites
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jegtnes on github.
  • I am jegtnes ( on keybase.
  • I have a public key ASCKHOB0n6Q26jdAWmdre4m72ud1r0B4JEQ_FBMyRETwowo

To claim this, I am signing this object:

View pre-push
mocha_skip_found=`git grep -e ".only" --or -e ".skip" HEAD`
if [ "$mocha_skip_found" ]
commit=`git log --pretty=format:'%Cred%h%Creset %s' -G "(.only|.skip)" | head -n1`
echo "Found Mocha test suite skip. This change was last introduced in:"
echo $commit
echo "Not pushing. (override with the --no-verify flag)"
jegtnes / Gulpfile.js
Created Jun 1, 2014
The Gulpfile I created for the blogpost, detailing how to use UnCSS and Gulp for Ghost.
View Gulpfile.js
var gulp = require('gulp');
var sass = require('gulp-sass'); // skip this if you're working with vanilla CSS
var rename = require('gulp-rename');
var cmq = require('gulp-combine-media-queries');
var uncss = require('gulp-uncss');
var download = require('download');
var cssmin = require('gulp-cssmin');
var clean = require('gulp-clean');
var xml2js = require('gulp-xml2js');
jegtnes / greentored.scss
Last active Aug 29, 2015
A SCSS function generating 100 classes from green to red.
View greentored.scss
$i: 0;
$color: rgb(0, 255, 0);
@while $i < 100 {
$i: $i + 1;
.color-#{$i} {
color: $color;
$color: adjust-color($color, $red: 2.55, $green: -2.55);
jegtnes / Antiviral
Last active Jan 6, 2017
A list of Tweetbot mute filters for "viral" clickbaity headlines to reduce the amount of pageview-farming crap listicles you get exposed to on the internet these days. Inspired by @snipe's Downworthy: — if only Tweetbot supported regex replace…
View Antiviral
(?i)(([0-9]{1,3})|three|four|five|six|seven|eight|nine|ten|eleven|twelve|twenty|eigh|thir|four|fif|six|seven|eight|nine)(teen|ty)?( (more|extra))? (reasons?|weird|things?|gifs?|spectacular|fantastic|tips|pieces|confessions|awesome|ludicrous|incredible|stages|movies?|films?|crazy|epic|easy|outrageous(ly)?|hilarous(ly)?|scar(y|iest)|\bof the\b|ways?|signs?|life ?(hacks?)|tweets|impossibl(e|ly)|productiv(e|ivity)|quotes|apps|best|simple)
(?i)what happen(s|ed) next
(?i)((won|can)'t|(will|can) ?not) believe
(?i)faith in humanity
(?i)can('|no)?t (even )?handle
(?i)(life|work(place)?|office) hacks?
jegtnes / sass_colorfunctions.php
Created Jun 6, 2013
A function attempting to rudimentary replicate SASS lighten/darken functions. Adapted from Frxstrem's answer on StackOverflow:
View sass_colorfunctions.php
function sass_darken($hex, $percent) {
preg_match('/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i', $hex, $primary_colors);
str_replace('%', '', $percent);
$color = "#";
for($i = 1; $i <= 3; $i++) {
$primary_colors[$i] = hexdec($primary_colors[$i]);
$primary_colors[$i] = round($primary_colors[$i] * (100-($percent*2))/100);
$color .= str_pad(dechex($primary_colors[$i]), 2, '0', STR_PAD_LEFT);
jegtnes / wp_deploy.sql
Last active Dec 15, 2015
A short database query to run after transferring a WordPress database to a different environment. From local to stage, stage to production, etc. Remember to change the name of the table if you've set a custom prefix.
View wp_deploy.sql
UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, '', '');
UPDATE wp_posts SET post_content = replace(post_content, '', '');
jegtnes / gist:5123868
Created Mar 9, 2013
Example of filtering by multiple categories and tags with a custom WP Query
View gist:5123868
$categories = $_GET( 'categories' );
$tags = $_GET( 'tags' );
$query = new WP_Query(
array( 'cat' => $categories ),
array( 'tags' => $tags )
while ( $query->have_posts() ) :
jegtnes / bg-color>bg-image.css
Created Jun 15, 2012
:after hack to apply background-color above background-image without extra markup
View bg-color>bg-image.css
header:after {
background-color: rgba(0, 0, 0, 0.3);
content: "";
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: -1;