Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
// = Earthberries !!

Travis van der F. tfont

💭
// = Earthberries !!
View GitHub Profile
@tfont
tfont / .jshintrc.js
Last active Jun 17, 2019 — forked from connor/.jshintrc.js
jshintrc example [updated]
View .jshintrc.js
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
"esversion" : 6, // allowing ES6
// Predefined globals whom JSHint will ignore.
@tfont
tfont / because.txt
Created Aug 27, 2018
Useless phases for code testing.
View because.txt
Here I am.
Bam, like a cheesecake.
@tfont
tfont / excerpt.php
Created Jun 11, 2018 — forked from wpscholar/excerpt.php
Generate an excerpt from provided content. Strips HTML, removes trailing punctuation and adds a 'more' string when text has been removed.
View excerpt.php
<?php
/**
* Get an excerpt
*
* @param string $content The content to be transformed
* @param int $length The number of words
* @param string $more The text to be displayed at the end, if shortened
* @return string
*/
@tfont
tfont / wp-get_id_by_slug
Last active Jun 11, 2018 — forked from lcdsantos/wp-get_id_by_slug
WordPress: Get page ID from slug
View wp-get_id_by_slug
// Usage:
// get_id_by_slug('any-page-slug');
function get_id_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page) {
return $page->ID;
} else {
return null;
}
@tfont
tfont / search_string_allocator.php
Created Mar 28, 2018
PHP Search Function to add to eephplib
View search_string_allocator.php
<?php
function search_string_allocator($search_string, $safe_length = 3)
{
$search_string = strtolower(trim($search_string));
if (strlen($search_string) >= $safe_length)
{
$removals = array
(
@tfont
tfont / gist:029b37713de3fca3aac52365450b8442
Created Dec 5, 2017
MySQL: Get Custom Post Type & Custom ACF by Post Name
View gist:029b37713de3fca3aac52365450b8442
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
@tfont
tfont / WP_Wrapper.php
Created Aug 11, 2017
Work-in-Process: Simple small WordPress Wrapper to make Plugin and Hook programming more object oriented.
View WP_Wrapper.php
namespace WP_Wrapper
{
abstract class Options
{
// wp-includes/option.php
public static function update($option, $value, $autoload = NULL)
{
return update_option($option, $value, $autoload);
}
@tfont
tfont / toggleFullscreen.js
Created Aug 3, 2017
JavaScript Snippet – toggleFullscreen()
View toggleFullscreen.js
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)
{
View feedly.ompl
<?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"/>
@tfont
tfont / jquery-ajax-all.js
Created Jun 28, 2017
How To Get Every Value From A Form When Submitting Via AJAX With JQuery
View jquery-ajax-all.js
$.ajax({
//...
data: $("#my-form").serialize(),
// ...
})