Skip to content

Instantly share code, notes, and snippets.

View TMMC's full-sized avatar

TMMC TMMC

View GitHub Profile
@TMMC
TMMC / wordpress-code-snippets.php
Last active February 1, 2023 15:52
Wordpress code snippets
<?php
/* Add excerpt for page posty type */
add_post_type_support('page', 'excerpt');
?>
<?php
/* Add shortcode for current year */
add_shortcode('current_year', 'tmmc_current_year_shortcode');
function tmmc_current_year_shortcode() {
return date('Y');
@TMMC
TMMC / empty-windows-terminal-scheme.json
Last active September 10, 2020 09:49
Empty Windows Terminal Colour Scheme template
{
"name" : "",
"foreground" : "",
"background" : "",
"cursorColor" : "",
"selectionBackground" : "",
"black" : "",
"red" : "",
"green" : "",
"yellow" : "",
@TMMC
TMMC / gitBash_windows.md
Created August 14, 2020 09:55 — forked from evanwill/gitBash_windows.md
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@TMMC
TMMC / photoswipe-init.js
Created January 21, 2019 21:07
Photoswipe working with `ul > li > figure > a > img` structure.
/* HTML structure:
* <ul>
* <li>
* <figure>
* <a>
* <img />
* </a>
* <figcaption></figcaption>
* <figure>
* </li>
/**
* BLOCK: wp-block-fns-blocks-page-intro (page-intro)
*/
// == Block dependencies
import classnames from 'classnames';
import blockIcons from '../icons';
import './style.scss';
import './editor.scss';
@TMMC
TMMC / jquery.photoswipe.js
Last active December 1, 2018 20:09 — forked from kshnurov/jquery.photoswipe.js
PhotoSwipe: init from DOM using jQuery
(function( $ ) {
$.fn.photoswipe = function(options){
var galleries = [],
_options = options;
var init = function($this){
galleries = [];
$this.each(function(i, gallery){
galleries.push({
id: i,
@TMMC
TMMC / gist:b8a8bba1ed435cd3a30fc58c195bb583
Created August 17, 2017 08:31 — forked from jbreitenbucher/gist:1996830
WordPress: Custom Post Type Template
<?php
/**
* Post Types
*
* This file registers any custom post types
*
* @package dorman-farrell
* @author The Pedestal Group <kathy@thepedestalgroup.com>
* @copyright Copyright (c) 2012, Dorman Farrell
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@TMMC
TMMC / bootstrap_pagination.php
Created August 7, 2017 06:17 — forked from tamarazuk/bootstrap_pagination.php
WordPress Bootstrap Pagination (In active development)
<?php
/**
* Bootstrap Pagination.
*
* Echos Bootstraped paginated links (http://getbootstrap.com/components/#pagination).
*
* @since 0.0.1
*
* @param array $args {
* An array of arguments. Optional.
@TMMC
TMMC / register-post-type.php
Created July 26, 2017 08:06 — forked from justintadlock/register-post-type.php
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@TMMC
TMMC / custom-gallery-format-for-wordpress.md
Last active April 14, 2019 03:52
Custom gallery format for WordPress (using Bootstrap v3 grid).