Skip to content

Instantly share code, notes, and snippets.

Ryan Niswonger rniswonger

View GitHub Profile
@rniswonger
rniswonger / nextdoor-bookmarklet.js
Created Oct 9, 2017
Bookmarklet: Hide annoying content on NextDoor
View nextdoor-bookmarklet.js
javascript:$('.content-scope-line:contains("Classifieds")').parents('.post-container').hide();$('.classifieds-single-item-content').hide();$('.content-scope-line:contains("Free items")').parents('.post-container').hide();$('.content-scope-line:contains("Recommendations")').parents('.post-container').hide();$('.content-scope-line:contains("Lost & Found")').parents('.post-container').hide();$('.post-byline:contains("Sponsored")').parents('.post-container').hide();
@rniswonger
rniswonger / svg-url.scss
Created Oct 7, 2017
SASS Mixin: Generate background-image using raw SVG
View svg-url.scss
// Function to create an optimized svg url
// http://codepen.io/jakob-e/pen/doMoML
@function svg-url($svg) {
// Chunk up string in order to avoid "stack level too deep" error
$encoded: '';
$slice: 2000;
$index: 0;
$loops: ceil(str-length($svg)/$slice);
@for $i from 1 through $loops {
$chunk: str-slice($svg, $index, $index + $slice - 1);
@rniswonger
rniswonger / em-value.scss
Created Oct 7, 2017
Sass Mixin: Generate EM value from px
View em-value.scss
// generate an em value
@function em($target_px, $context_px: 16) {
@return $target_px / $context_px * 1em;
}
@rniswonger
rniswonger / fluid-text.scss
Last active Oct 7, 2017
Sass Mixin: Fluid Text
View fluid-text.scss
// fluidly resize type
// based on example here https://css-tricks.com/snippets/css/fluid-typography/
@mixin fluid-type($font-min, $font-max, $screen-min, $screen-max) {
font-size: #{$font-min}px;
@media only screen and (min-width: #{$screen-min}px) {
font-size: calc(
#{$font-min}px + #{($font-max - $font-min)} * (100vw - #{$screen-min}px) / (#{$screen-max} - #{$screen-min})
);
}
@rniswonger
rniswonger / hyphenate.css
Last active Oct 7, 2017
CSS: Hyphenate / Break text
View hyphenate.css
.hyphenate-text {
word-break: break-word; // for (non-mac) chrome
hyphens: auto; // for the rest
}
@rniswonger
rniswonger / rays.js
Last active Nov 16, 2016 — forked from alanedwardes/rays.js
Generates animated sun rays using HTML canvas
View rays.js
var rays = new Object({
canvas: false,
context: false,
offset: 0,
speed: 0.005,
animating: false,
color_1: '',
color_2: '',
mid_x: 0,
@rniswonger
rniswonger / wp-disable-plugin-update.php
Last active Mar 15, 2019
WordPress - Disable specific plugin update check
View wp-disable-plugin-update.php
/**
* Prevent update notification for plugin
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
if ( isset($value) && is_object($value) ) {
if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
unset( $value->response['plugin-folder/plugin.php'] );
}
@rniswonger
rniswonger / script.js
Last active Oct 19, 2016
Scroll-away header
View script.js
/**
* Header animation with requestAnimationFrame debounce
* https://www.html5rocks.com/en/tutorials/speed/animations/
*/
(function($) {
$(document).ready(function() {
var lastKnownScrollY = 0;
var lastUpdatedScrollY = 0;
var scrollCheck = false;
var showingHeader = false;
View remove-google-analytics-utm-from-addressbar.js
// Wes Bos
// https://twitter.com/wesbos/status/766703272887476224
function removeUTM() {
const loc = window.location;
if (loc.search.includes('utm')) {
if (window.history.replaceState) {
history.replaceState({}, '', loc.pathname);
} else {
loc.hash = '';
}
@rniswonger
rniswonger / config.json
Last active Jun 28, 2016 — forked from anonymous/config.json
Bootstrap Customizer Config - Minimum components for navbar w/dropdowns
View config.json
{
"vars": {},
"css": [
"forms.less",
"responsive-utilities.less",
"navs.less",
"navbar.less",
"component-animations.less",
"dropdowns.less"
],
You can’t perform that action at this time.