Skip to content

Instantly share code, notes, and snippets.

View Tusko's full-sized avatar

Tusko Trush Tusko

View GitHub Profile
@Tusko
Tusko / wakaTimer.js
Created January 16, 2016 09:44
wakaTimer
var wakaTimer;
function blurWindow(){
wakaTimer = setInterval(function(){
handleAction(true);
}, 5e3);
}
function setupEventListeners() {
MainViewManager.on('currentFileChange', function () {
@Tusko
Tusko / valign.css
Created February 2, 2016 09:38
valign css
// Vertical align inside DIV
// <span class="valign">Some content</span>
// <span class="vfix"></span>
.valign {display: inline-block;vertical-align: middle; max-width: 98%}
.vfix {display: inline-block;height: 100%;vertical-align: middle;width: 0}
@Tusko
Tusko / functions.php
Last active February 27, 2022 13:46
WP Ajax search (ACF included)
<?php
/* Wordpress Custom Search by title, ACF, post_meta */
// Wordpress ?s= redirect to /search/
function wpa_search_redirect() {
global $wp_rewrite;
if (!isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->using_permalinks()) { return; }
$search_base = $wp_rewrite->search_base;
if (is_search() && !is_admin() && strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false) {
wp_redirect(home_url("/{$search_base}/" . urlencode(get_query_var('s'))));
// Custom JS
var catConfig = {
hideControlOnEnd: true,
adaptiveHeight: true,
infiniteLoop: false,
useCSS: false,
prevText: '',
nextText: '',
pager: false,
speed: 350
$green: #008744;
$blue: #0057e7;
$red: #d62d20;
$yellow: #ffa700;
// scaling... any units
$width: 30px;
.showbox {
-webkit-transition: all .5s ease;
@Tusko
Tusko / donetyping.js
Last active January 15, 2018 11:08
donetyping
;(function($){
$.fn.extend({
donetyping: function(callback,timeout){
timeout = timeout || 1e3; // 1 second default timeout
var timeoutReference,
doneTyping = function(el){
if (!timeoutReference) return;
timeoutReference = null;
callback.call(el);
};
@Tusko
Tusko / rand_cat_to_post.php
Last active April 10, 2023 16:03
Append custom taxonomy to CPT
<?php
$tax = 'YOUR_TAX_HERE';
$cpt = 'YOUR_CPT_HERE';
$count = 3;
$types = get_terms(array(
'taxonomy' => $tax,
'hide_empty' => false,
'parent' => 0
));
$arr = array(
@Tusko
Tusko / facebook_page_latest_post_no_php_sdk.php
Last active October 13, 2016 14:26 — forked from biojazzard/facebook_page_latest_post_no_php_sdk.php
Get Latest Post From a Facebook Page without PHP SDK (Graph Version v2.5)
<?php
/*
1.- Create an App.
2.- Go to: https://developers.facebook.com/tools/explorer/
+ Select your new created app on the right top.
+ Select "Get App Token"