Skip to content

Instantly share code, notes, and snippets.

View rhcarlosweb's full-sized avatar
🖖

Rhuan Carlos rhcarlosweb

🖖
View GitHub Profile
@rhcarlosweb
rhcarlosweb / animations.js
Last active March 26, 2020 19:47
Scroll Magic Animations
const controller = new ScrollMagic.Controller();
window.addEventListener("load", function (event) {
/**
* Fade In
* @type {NodeListOf<Element>}
*/
const fadeIn = document.querySelectorAll('.fade-in');
fadeIn.forEach(e => {
const delay = e.getAttribute('data-delay') ? e.getAttribute('data-delay') : 0;
<div class="countdown" data-h="" data-m="0" data-s="15">
<div class="countdown__num -h">00</div>
<div class="countdown__sep">:</div>
<div class="countdown__num -m">00</div>
<div class="countdown__sep">:</div>
<div class="countdown__num -s">00</div>
</div>
<div class="countdown__num -finished">FINALIZADA</div>
@rhcarlosweb
rhcarlosweb / gulpfile.js
Last active September 24, 2019 22:31
New Gulpfile config
// of course gulp
const {src, dest, parallel, series, watch} = require('gulp');
// css
const sass = require('gulp-sass');
sass.compiler = require('node-sass');
const autoprefixer = require('autoprefixer');
const cssnano = require('gulp-cssnano');
const rucksack = require('rucksack-css');
const magicImporter = require('node-sass-magic-importer');
@rhcarlosweb
rhcarlosweb / .gitconfig
Last active July 22, 2020 00:38
GitConfig Alias
[alias]
co = checkout
br = branch
ci = commit
st = status
hide = update-index --assume-unchanged
unhide = update-index --no-assume-unchanged
unstage = reset HEAD --
last = log -1 HEAD
ps = push
@rhcarlosweb
rhcarlosweb / instaGrabJquery.js
Last active April 3, 2020 18:32
Instagram Scrapper Images
function instagramFeed(username, container = ".instagram-feed", numOfImages = 6) {
const host = 'https://www.instagram.com/';
const url = host + username;
const hostImageUrl = host + 'p/';
let userFeed = {};
// request data
$.get(url, function (data) {
// get content from script tag
@rhcarlosweb
rhcarlosweb / taxonomy_hierarchy.php
Last active May 19, 2019 05:10
Taxonomy Hirarchy
<?php
function taxonomy_hierarchy( $taxonomy ) {
global $post;
$terms = get_the_terms( $post->ID, $taxonomy );
foreach ( $terms as $term ) {
if ( $term->parent == 0 ) {
$myparent = $term;
}
}
echo '' . $myparent->name . '';
@rhcarlosweb
rhcarlosweb / wordpress_popular_posts.php
Created May 4, 2019 05:28
WordPress Popular Posts with WP_Query
function ChangeLang(a) {
var b, elemento = "";
if (document.createEvent) {
var c = document.createEvent("HTMLEvents");
c.initEvent("click", true, true)
}
if (a == 'pt') {
elemento = $(".goog-te-banner-frame:eq(0)").contents().find("button[id*='restore']")
} else {
switch (a) {
@rhcarlosweb
rhcarlosweb / menu-name-wordpress.php
Created February 13, 2019 19:44
Get wordpress menu name
<?php
/**
* Get Menu id
*
* @param $name_location
*
* @return
*/
function nexo_menu_title( $name_location = '' ) {
if ( has_nav_menu( $name_location ) ) :
@rhcarlosweb
rhcarlosweb / functions.php
Created July 7, 2018 19:43
Disable Comments WodPress
<?php
// Disable support for comments and trackbacks in post types
add_action( 'admin_init', 'nexo_disable_comments_post_types_support' );
function nexo_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
if ( post_type_supports( $post_type, 'comments' ) ) {
remove_post_type_support( $post_type, 'comments' );
remove_post_type_support( $post_type, 'trackbacks' );
}