Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Cernis nickcernis

  • Innsbruck, Austria
View GitHub Profile
@nickcernis
nickcernis / functions.php
Last active Sep 12, 2018 — forked from bgardner/functions.php
Adds support for editor color palette for sites using the Genesis Framework.
View functions.php
<?php
// Do NOT include the opening php tag.
// Adds support for editor color palette.
add_theme_support( 'editor-color-palette', array(
array(
'name' => __( 'Light gray', 'genesis-sample' ),
'slug' => 'light-gray',
'color' => '#f5f5f5',
),
@nickcernis
nickcernis / command.md
Created Aug 26, 2018
Delete all node_modules directories
View command.md
❯ find /Path/to/parent/folder -name "node_modules" -type d -prune -exec rm -rf '{}' +
@nickcernis
nickcernis / readme.md
Last active Jan 15, 2021
Exclude node_modules and .git from Backblaze backups on Mac
View readme.md

Exclude node_modules and .git from Backblaze backups on Mac

  1. Edit the file at /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml.
  2. Add these rules inside the bzexclusions tag:
<!-- Exclude node_modules. -->
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
@nickcernis
nickcernis / functions.php
Created Jul 31, 2018
Fix Google Schema error for custom logos on WordPress sites.
View functions.php
<?php
/**
* Fix Google Schema error, "The property logo is not recognised by Google for an object of type WPHeader".
*
* @param string $html The logo HTML.
*
* @return string The modified HTML.
*/
add_filter( 'get_custom_logo', function( $html ) {
$html = str_replace( 'itemprop="logo"', 'itemprop="image"', $html );
@nickcernis
nickcernis / wrap.sh
Last active Aug 26, 2018
Mac shell script: wrap clipboard contents to 70 characters and prefix as markdown blockquote, preserving links and non-ASCII
View wrap.sh
pbpaste | fmt -w 70 | sed -e 's/^/> /'
@nickcernis
nickcernis / functions.php
Created Oct 20, 2017
Strip the ellipsis from the Genesis read more text in the Featured Page widget
View functions.php
<?php
add_filter( 'get_the_content_more_link', 'custom_remove_ellipsis' );
/**
* Strips the ellipsis from the Genesis more link.
*
* @param string $more_link_html The current more link HTML.
* @return string The link HTML without the ellipsis.
*/
function custom_remove_ellipsis( $more_link_html ) {
$link_without_ellipsis = str_replace( '&#x02026;', '', $more_link_html );
View Makefile
include config/theme-info.make
include src/make/theme-info-original.make
include src/make/show-help-from-comments.make
.PHONY: help sass build watch bump gitinit rename undo-rename dist clean b r ur gi ts
help: show-help-from-comments
## Watch and build Sass files only. Compiles all Sass to style.css, unminified.
sass:
@nickcernis
nickcernis / functions.php
Created Sep 20, 2016
Reorder Simple Social Icons
View functions.php
<?php
add_filter( 'simple_social_default_profiles', 'custom_reorder_simple_icons' );
function custom_reorder_simple_icons( $icons ) {
// Set your new order here
$new_icon_order = array(
'bloglovin' => '',
'dribbble' => '',
'email' => '',
View dnsmasq.md

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

@nickcernis
nickcernis / parsing-urls.js
Created Jul 27, 2016
Parsing URLs in JavaScript
View parsing-urls.js
// From https://news.ycombinator.com/item?id=12172180
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
You can’t perform that action at this time.