This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var coisarada; | |
clearInterval(coisarada); | |
coisarada = setTimeout(function(){ | |
console.log('Down'); | |
},70); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Plugin Name: Nome do plugin | |
* Plugin URI: http://www.site.com.br/ | |
* Description: Descrição do plugin | |
* Author: Autor | |
* Version: 1.0 | |
* Author URI: http://www.autor-site.com.br/ | |
* License: | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
@author Cristiano de Mari | |
@param Int $ID | |
@param String $attachment | |
@param Array $args | |
@return <img /> | |
*/ | |
function img($ID = NULL, $thumb_size = 'post-thumbnail',$args = NULL ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @name Mutlidimensional Array Sorter. | |
* @author Tufan Barış YILDIRIM | |
* @link http://www.tufanbarisyildirim.com | |
* @github http://github.com/tufanbarisyildirim | |
* | |
* This function can be used for sorting a multidimensional array by sql like order by clause | |
* | |
* @param mixed $array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function theme_name_scripts() { | |
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/main.js', array(), '1.0.0', true ); | |
wp_enqueue_style('main2' , get_template_directory_uri() ."/css/main2.css"); | |
} | |
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'posts_where', 'like_title', 10, 2 ); | |
function like_title( $where, &$wp_query ) { | |
global $wpdb; | |
if ( $title = $wp_query->get( 'title' ) ) { | |
$where .= ' AND ' . $wpdb->posts . '.post_title LIKE \'%' . esc_sql( $wpdb->esc_like( $title ) ) . '%\''; | |
} | |
return $where; | |
} | |
$search_query = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="http://www.site.com.br/nomedaimagem.png" class="hires"> | |
if (window.devicePixelRatio >= 2) { | |
var images = $("img.hires"); | |
// loop through the images and make them hi-res | |
for(var i = 0; i < images.length; i++) { | |
// create new image name | |
var imageType = images[i].src.substr(-4); | |
var imageName = images[i].src.substr(0, images[i].src.length - 4); | |
imageName += "@2x" + imageType; | |
//rename image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Mutex = function() { | |
this.queues = []; | |
this.locked = false; | |
}; | |
Mutex.prototype = { | |
push: function(callback) { | |
var self = this; | |
this.queues.push(callback); | |
if (!this.locked) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function detect_mobile(){ | |
if(preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', | |
$_SERVER['HTTP_USER_AGENT'])) | |
return true; | |
else | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_li_link(label,url,ul_class){ | |
var ul = document.getElementsByClassName(ul_class)[0]; | |
var ul = ul.getElementsByTagName("ul")[0]; | |
var li = document.createElement("li"); | |
var a = document.createElement("a"); | |
a.href = url; | |
a.appendChild(document.createTextNode(label)); | |
li.appendChild(a); | |
ul.appendChild(li); | |
} |