Skip to content

Instantly share code, notes, and snippets.

View livingstonef's full-sized avatar

Livingstone F livingstonef

View GitHub Profile
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
//
// ToolbarCustomView.swift
// LabDoc
//
// Created by Livingstone Fultang on 24/07/2016.
// Copyright © 2016 Livingstone Fultang. All rights reserved.
//
import Cocoa
#!/bin/sh
scss $2:$3 --quiet --update --no-cache && {
printf '\n<dom-module id="%s-style">\t\n<template>\t\t\n<style>\n' "$1"
cat $3
printf '\t\t\n</style>\t\n</template>\n</dom-module>'
} > "$1-style".html && rm -- "$3"
exit

Install MAPP (MAMP) stack on Mavericks using MacPorts

I keep most of my Apache/PHP/Percona (MySQL) configuration stuff in a local Git repository so I can track changes and I symlink to those from where they should be so you will see commands such as

 sudo ln -s ~/Documents/configs/PHP/fat-tony.local/php55.ini /opt/local/etc/php55/php.ini 

If you don’t have a similar setup, just copy your configuration files to where they need to be.

I like to prepend some of the commands with time just for curiosity’s sake to see how long it takes.

@livingstonef
livingstonef / cpgcal
Last active August 29, 2015 14:03
CpG Island calculator
<?php
/**
* @author: Livingstone Fultang
* @license: GPL
**/
//create a file name sequence in the same directory and paste your sequence
//in a variable like so $sequence = "AGCTGAGTCGATCGACTGACGTACGTACG"; return $sequence;
require 'sequence.php';
/**
* "Google Now" Card
*/
body {
background: #e1e1e1;
min-height: 100%;
margin: auto;
}
ul.gNow {
width: 450px;
@livingstonef
livingstonef / LFT_Toc
Last active December 15, 2015 20:29
Here is a quick example of how to use the LFT_Toc but have the TOC in a sidebar or anywhere else
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* video.php
*
* Requires PHP version 5.0 or more
*
* LICENSE: This source file is subject to version 3.01 of the GNU/GPL License
@livingstonef
livingstonef / gist:4122479
Created November 21, 2012 01:26
EAV Multiple Joins
SELECT o.object_id, o.object_uri, o.object_type,
#Activity attributes
MAX(IF(p.property_name = 'activity_published', v.value_data, null)) AS activity_published,
MAX(IF(p.property_name = 'activity_content', v.value_data, null)) AS activity_content,
MAX(IF(p.property_name = 'activity_summary', v.value_data, null)) AS activity_summary,
MAX(IF(p.property_name = 'activity_comment_status', v.value_data, null)) AS activity_comment_status,
MAX(IF(p.property_name = 'activity_parent', v.value_data, null)) AS activity_parent,
MAX(IF(p.property_name = 'activity_generator', v.value_data, null)) AS activity_generator,
MAX(IF(p.property_name = 'activity_provider', v.value_data, null)) AS activity_provider,
@livingstonef
livingstonef / gist:3807586
Created September 30, 2012 16:57
EAV Proptery Datatypes
INSERT INTO `property_datatypes` (`datatype_id`, `datatype_name`, `datatype_is_numeric`, `datatype_is_datetime`, `datatype_not_null`, `datatype_validation`) VALUES
(1, 'char', 0, 0, 0, NULL),
(2, 'varchar', 0, 0, 0, NULL),
(3, 'tinytext', 0, 0, 0, NULL),
(4, 'text', 0, 0, 0, NULL),
(5, 'mediumtext', 0, 0, 0, NULL),
(6, 'longtext', 0, 0, 0, NULL),
(7, 'blob', 0, 0, 0, NULL),
(8, 'mediumblob', 0, 0, 0, NULL),
(9, 'longblob', 0, 0, 0, NULL),
@livingstonef
livingstonef / gist:3790616
Created September 26, 2012 21:12
EAV Validation
DROP PROCEDURE IF EXISTS `property_value_validate`;
DELIMITER //
CREATE PROCEDURE `property_value_validate`(IN _property_id INT, IN _value_data LONGTEXT)
BEGIN
DECLARE _validationFails CONDITION FOR SQLSTATE '99001';
DECLARE _dataType INT;
DECLARE _dataTypeRegExp VARCHAR(255);
SET _dataType = (SELECT DISTINCT `property_datatype` FROM `properties` WHERE `property_id`= _property_id );
SET _dataTypeRegExp = (SELECT DISTINCT `datatype_validate` FROM `property_datatypes` WHERE `datatype_name`= _dataType );
IF (_dataTypeRegExp IS NOT NULL) THEN