Skip to content

Instantly share code, notes, and snippets.

View Cammoy's full-sized avatar

Kwasi Brown Cammoy

  • London, England
View GitHub Profile
@Cammoy
Cammoy / cloudSettings
Last active March 31, 2020 08:53
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-03-31T08:53:14.311Z","extensionVersion":"v3.4.3"}
@Cammoy
Cammoy / custom-post--category-template-wordpress
Created June 15, 2018 21:50
WordPress custom category Post template
// Custom Post Template
//------------------------------------------------
add_filter('single_template', 'check_for_category_single_template');
function check_for_category_single_template( $t )
{
foreach( (array) get_the_category() as $cat )
{
if ( file_exists(TEMPLATEPATH . "/single-category-{$cat->slug}.php") ) return TEMPLATEPATH . "/single-category-{$cat->slug}.php";
if($cat->parent)
@Cammoy
Cammoy / create-mint-sh
Created June 1, 2018 18:21 — forked from gildas/create-mint-sh
Create Linux Mint USB on Mac OS/X
#! /usr/bin/env bash
# Insert a USB key.
# if needed initialize it with MS/DOS FAT and MBR
# Download the Mint ISO image
# Convert the ISO -> IMG
hdiutil convert -format UDRW -o linuxmint-17.3-cinnamon-64bit linuxmint-17.3-cinnamon-64bit.iso
# Run a diskutil list to know the device for the USB key, e.g.: /dev/disk3
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@Cammoy
Cammoy / new_gist_file
Created November 16, 2013 23:10
Fix IE Rendering Problems put immediately after head tag
<meta http-equiv="x-ua-compatible" content="IE=edge">
@Cammoy
Cammoy / ie8-images.css
Created November 16, 2013 22:41
* Show disappearing images in IE8
img {
width:auto !important;
}
@Cammoy
Cammoy / db-connect.php
Created November 11, 2013 00:42
Connect to MySQL DB OO Style
define( "DB_HOST" , "localhost" );
define( "DB_NAME" , "" );
define( "DB_USER" , "" );
define( "DB_PASS" , "" );
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
@Cammoy
Cammoy / 0_reuse_code.js
Created November 11, 2013 00:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!DOCTYPE html>
<html>
<head>
<title>CSS Pulsator</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="pulsor">Pulsate!</div>
</body>
</html>
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php
*/
$args = array(