Skip to content

Instantly share code, notes, and snippets.

@cdmz
cdmz / mata-executa-javascript.js
Created September 25, 2015 21:29
mata executa javascript
var coisarada;
clearInterval(coisarada);
coisarada = setTimeout(function(){
console.log('Down');
},70);
@cdmz
cdmz / get-page-by-slug-wordpress.php
Created September 25, 2015 14:01
get page by slug get-page-by-slug-wordpress.php
<?php
$pag = get_page_by_path('slug-page');
echo get_permalink($page_sms->ID);
?>
@cdmz
cdmz / pagination-wordpress.php
Last active September 24, 2015 20:40
pagination wordpress
<?php
function pagination($pages = '', $range = 4){
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
global $wp_query;
@cdmz
cdmz / jquery-ajax-with-abort-previous-xhr.js
Created September 16, 2015 12:28
jquery ajax with abort previous xhr
var xhr_ = null ,xhr = null,timeout_seconds = 10*1000 ;
$("body").on('click',function(){
load_ajax();
});
function load_ajax(){
xhr_ = xhr;
xhr = $.ajax({
url: 'http://localhost/teste.php',
type: 'GET',
dataType: 'json',
@cdmz
cdmz / cookie-set-favorite-id.js
Last active September 22, 2015 20:37
cookie set favorite item by id
@cdmz
cdmz / msconvert.js
Last active September 1, 2015 14:16 — forked from remino/msconvert.js
JavaScript: Convert milliseconds to object with days, hours, minutes, and seconds
function convertMS(ms) {
var d, h, m, s;
s = Math.floor(ms / 1000);
m = Math.floor(s / 60);
s = s % 60;
h = Math.floor(m / 60);
m = m % 60;
d = Math.floor(h / 24);
h = h % 24;
return { d: d, h: h, m: m, s: s };
@cdmz
cdmz / register-taxonommy.php
Last active August 29, 2015 14:27
register taxonomy wordpress
<?php
register_taxonomy( 'apresentacao',
array( 'programacao' ),
array(
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'show_admin_column' => false,
'labels' => array (
'name' => __( 'Apresentações', 'Sesc Bienal' ),
@cdmz
cdmz / register-taxonomy-by-post-type.php
Created August 14, 2015 13:23
register taxonomy by post type
register_taxonomy( 'blog-assunto',
array( 'blog' ),
array(
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'show_admin_column' => false,
'labels' => array (
'name' => __( 'Assuntos', 'egali' ),
'singular_name' => __( 'Assunto', 'egali' ),
@cdmz
cdmz / selector-dinamic-elements-jquery.js
Created August 14, 2015 13:20
Selector dimamic elements jquery
$(document).on('click', '#element', function (e) {
});
@cdmz
cdmz / watch-sass-dir.txt
Created August 5, 2015 00:17
watch sass dir
sass --watch project/sass:project/css