Skip to content

Instantly share code, notes, and snippets.

View travisfont's full-sized avatar
🍇
// = Earthberries !!

Travis van der F. travisfont

🍇
// = Earthberries !!
View GitHub Profile
@travisfont
travisfont / gist:029b37713de3fca3aac52365450b8442
Created December 5, 2017 16:37
MySQL: Get Custom Post Type & Custom ACF by Post Name
ID post_author post_date post_date_gmt post_content post_title post_excerpt post_status comment_status ping_status post_password post_name to_ping pinged post_modified post_modified_gmt post_content_filtered post_parent guid menu_order post_type post_mime_type comment_count
------ ----------- ------------------- ------------------- ------------ ------------------ ------------ ----------- -------------- ----------- ------------- ----------------- ------- ------ ------------------- ------------------- --------------------- ----------- --------------------------------------------------- ---------- --------- -------------- ---------------
2348 4 2017-11-29 09:33:03 2017-11-29 09:33:03 Travis Test publish closed closed travis-test 2017-11-29 09:36:09 2017-11-29 09:36:09
@travisfont
travisfont / WP_Wrapper.php
Created August 11, 2017 15:29
Work-in-Process: Simple small WordPress Wrapper to make Plugin and Hook programming more object oriented.
namespace WP_Wrapper
{
abstract class Options
{
// wp-includes/option.php
public static function update($option, $value, $autoload = NULL)
{
return update_option($option, $value, $autoload);
}
@travisfont
travisfont / toggleFullscreen.js
Created August 3, 2017 22:50
JavaScript Snippet – toggleFullscreen()
function toggleFullscreen(e)
{
var d = document, done;
e = e || d.documentElement;
'-frsexit ms-FRsExit moz-FRSCancel webkit-FRsExit'.replace(/(\w*)-(f)(r)(s)(\w+)/gi, function (_, p, f, r, s, c)
{
if (!done)
{
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Pierre subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="all" title="all">
<outline type="rss" text="ScaleScale.com" title="ScaleScale.com" xmlUrl="http://www.scalescale.com/feed/" htmlUrl="http://www.scalescale.com"/>
<outline type="rss" text="InfoQ" title="InfoQ" xmlUrl="https://www.infoq.com/fr/feed?token=SLR1jAj2muGO5L2U2sIUYaQgzGPlyuFP" htmlUrl="http://www.infoq.com"/>
@travisfont
travisfont / jquery-ajax-all.js
Created June 28, 2017 18:13
How To Get Every Value From A Form When Submitting Via AJAX With JQuery
$.ajax({
//...
data: $("#my-form").serialize(),
// ...
})
@travisfont
travisfont / Drop-All-Tables.sql
Last active March 25, 2017 10:47
This code drops all tables in the currently selected MySQL database.
SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN = 32768;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables,'dummy') INTO @tables;
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
@travisfont
travisfont / func.chaining.php
Created March 21, 2017 14:44
Function chaining for PHP 7
<?php
function _(&$_)
{
return new class($_)
{
private $_;
public function __construct(&$_)
{
@travisfont
travisfont / setElementClass.ts
Created February 22, 2017 14:56
Using Renderer and setElementClass/setElementStyle APIs (Web, Server, WebWorker)
export class SongTrack
{
constructor(
private element: ElementRef,
private renderer: Renderer
)
{
let elem = this.element.nativeElement;
renderer.setElementStyle(elem, "color", "blue");
@travisfont
travisfont / nativeElement.ts
Created February 22, 2017 14:54
Using ElementRef and nativeElement APIs (Browser)
export class SongTrack
{
constructor(private element: ElementRef)
{
let elem = this.element.nativeElement;
elem.style.color = "blue";
elem.style.cssText = "color: blue; ..."; // multiple styles
elem.setAttribute("style", "color: blue;");
}
@travisfont
travisfont / LocaleDateFormat.php
Created February 3, 2017 13:44
Simple Date Localization in PHP
<?php
class LocaleDateFormat
{
private $locale;
private $pattern;
public function __construct($pattern, $locale = 'en_US')
{
$this->setLocale($locale);