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(){ | |
function device_detect() { | |
if( navigator.userAgent.match(/Android/i) | |
|| navigator.userAgent.match(/webOS/i) | |
|| navigator.userAgent.match(/iPhone/i) | |
|| navigator.userAgent.match(/iPad/i) | |
|| navigator.userAgent.match(/iPod/i) | |
|| navigator.userAgent.match(/BlackBerry/i) | |
|| navigator.userAgent.match(/Windows Phone/i)){ | |
alert('Seu dispositivo mobile foi detectado'); |
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
/** | |
* Retorna um resumo de qualquer string por palavra | |
* @param string $string A string que será cortada | |
* @param int $max O número máximo de palavras | |
* @return string A string cortada | |
* By Cezinha <3 | |
*/ | |
function resumo($string, $max, $final = '...') { | |
$string = explode(' ', trim($string)); |
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 excerpt($limit) { | |
$excerpt = explode(' ', get_the_excerpt(), $limit); | |
if (count($excerpt)>=$limit) { | |
array_pop($excerpt); | |
$excerpt = implode(" ",$excerpt).'...'; | |
} else { | |
$excerpt = implode(" ",$excerpt); | |
} | |
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); | |
return $excerpt; |
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 variavel = document.querySelector('.title-main'); | |
variavel.addEventListener('click', function() { | |
if(variavel.classList.contains('classe')) { | |
this.classList.remove('classe'); | |
} | |
else { | |
this.classList.add('classe'); |
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 | |
// Page Slug Body Class | |
function add_slug_body_class( $classes ) { | |
global $post; | |
if ( isset( $post ) ) { | |
$classes[] = $post->post_type . '-' . $post->post_name; | |
} | |
return $classes; | |
} |
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
// Voltar ao Topo | |
$('.vr').on('click', function () { | |
$('body, html').animate({ | |
scrollTop: 0 | |
}); | |
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
// Change URL Hash on Scroll ======================================= | |
$(document).bind('scroll',function(e){ | |
$('.section-block').each(function(){ | |
if ( $(this).offset().top < window.pageYOffset + 10 && $(this).offset().top + $(this).height() > window.pageYOffset + 10) { | |
window.location.hash = $(this).attr('id'); | |
} | |
}); | |
}); |
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
// Refresh Page without URL Hash ======================================= | |
var loc = window.location.href, | |
index = loc.indexOf('#'); | |
if (index > 5000) { | |
window.location = loc.substring(0, index); | |
} |
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
<html ng-app="NgApp"> | |
<head> | |
<title>Add tasks with Angular JS / Adicionando tarefas com Angular JS</title> | |
</head> | |
<body> | |
<div ng-controller="TasksController"> | |