This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check out a working copy from a repository | |
svn co http://plugins.svn.wordpress.org/[plugin-slug]/ | |
# Bring changes from the repository into the working copy (use the command below for existing repo) | |
svn up | |
# Update "Tested up to" value with a new version number (using Vim or change `vi` to your editor of choice, e.g. `nano`) | |
vi trunk/readme.txt | |
# Copy readme.txt to the tag with the newest version of the plugin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inline for loop | |
for i in "item1" "item2"; do echo "$i"; done | |
# Alternative syntax | |
for i in {"item1","item2"}; do echo "$i"; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Shuffle an array using the modern Fisher–Yates shuffle algorithm. | |
* | |
* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm | |
* | |
* @param {array} array | |
* @returns {array} | |
*/ | |
function shuffleArray(array) { | |
let currentIndex = array.length; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Find deep data in an object. | |
* | |
* @param {object} data | |
* @param {string} path | |
* @return {*} | |
*/ | |
function findDeepData(data, path) { | |
const keysArr = path.split("."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get navigation position. | |
* | |
* @param {jQuery} $nav Navigation element. | |
* @returns {string} Navigation position (left, right or fullwidth). | |
*/ | |
function getNavigationMode($nav) { | |
let offset = $nav.offset(); | |
let distanceLeft = Math.round(offset.left - $(document).scrollLeft()); | |
let distanceRight = Math.round($(window).width() - distanceLeft - $nav.width()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Show a little arrow glyph after `target="_blank"` anchors. | |
Source: https://til.secretgeek.net/css/glyph_after_blank_anchors.html | |
*/ | |
a[target="_blank"]:after { | |
content: " \2197"; | |
font-size: 0.9em; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git apply diff | |
pbpaste | git apply | |
# Nice Git log with tags | |
git log --oneline --decorate | |
# Show commit difference between two branches | |
git log --oneline --decorate master..HEAD | |
# Log after specific date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set of functions to ensure safe colors. | |
// Inspired by: | |
// - https://pressupinc.com/blog/2014/06/preserving-readability-variable-text-background-colors-sass/ | |
// - http://blog.benjamincharity.com/generate-safe-text-colors-with-sass/ | |
$lightness-bound: 70 !default; | |
$hue-bound-bottom: 40 !default; | |
$hue-bound-top: 200 !default; | |
$brightness-diff-bound: 40% !default; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Taxonomy for media files. | |
*/ | |
function init_media_categories() { | |
register_taxonomy( 'media_cat', 'attachment', array( | |
'label' => __( 'Categories' ), | |
'hierarchical' => true, | |
'public' => false, | |
'show_ui' => true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $upgrading = time(); |
NewerOlder