Skip to content

Instantly share code, notes, and snippets.

View jqueryalmeida's full-sized avatar

Jquery Almeida jqueryalmeida

View GitHub Profile
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 15px;
width: 100%
}
.row {
display: -webkit-box;
display: -ms-flexbox;
@mixin for-phone-only {
@media (max-width: 599px) { @content; }
}
@mixin for-tablet-portrait-up {
@media (min-width: 600px) { @content; }
}
@mixin for-tablet-landscape-up {
@media (min-width: 900px) { @content; }
}
@mixin for-desktop-up {
@jqueryalmeida
jqueryalmeida / _blank.js
Created December 29, 2017 15:45 — forked from CrocoDillon/_blank.js
Automatically open external links in new tab or window.
// vanilla JavaScript
var links = document.links;
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
}
}
// or in jQuery
<?php
/* WooCommerce emails for cancelled pending orders */
add_action('woocommerce_order_status_pending_to_cancelled', 'pending_cancelled_send_an_email_notification', 10, 2 );
function pending_cancelled_send_an_email_notification( $order_id, $order ) {
if ( version_compare( WC_VERSION, '3.0.8', '>=' ) ) {
// Getting all WC_emails objects
$email_notifications = WC()->mailer()->get_emails();
// Sending the email
$email_notifications['WC_Email_Cancelled_Order']->trigger( $order_id );
@jqueryalmeida
jqueryalmeida / ajax.php
Created October 26, 2017 20:51 — forked from sniperwolf/ajax.php
Super-Simple WordPress ajax post-popup with jQuery and Reveal plugin
<?php
/**
* Template Name: ajax
*/
?>
<?php
$post = get_post($_GET['id']);
?>
<?php if ($post) : ?>
<?php setup_postdata($post); ?>
@jqueryalmeida
jqueryalmeida / comoSerChatoNoFacebook.js
Created October 20, 2017 13:04 — forked from callmeloureiro/comoSerChatoNoFacebook.js
Como fazer alguém te responder no facebook...
/*
Hoje iremos MUDAR a vida da pessoa que não te responde no Facebook...
Que tal enviar mensagens pra ela até obter uma resposta?!
Sensacional não acha?! Mas, somos devs, correto?! Então vamos automatizar esse paranauê!
Para utilizar:
- Abra o messenger.com;
- Selecione a conversa que você quer;
- Abra o console e cole o código que está no gist;
@jqueryalmeida
jqueryalmeida / co-authors-list.php
Created July 1, 2017 19:09 — forked from nciske/co-authors-list.php
List just co-authors with thumbnail
<?php
$args = array( 'post_type' => 'guest-author', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' );
$guest_authors = get_posts( $args );
foreach( $guest_authors as $ga ){
echo '<div class="contributor">';
@jqueryalmeida
jqueryalmeida / functions.php
Created May 21, 2017 14:44 — forked from gregrickaby/functions.php
Add Google Fonts to Wordpress (the right way)
<?php
add_action( 'wp_enqueue_scripts', 'child_load_google_fonts' );
/**
* Enqueue Google Fonts using a function
*/
function child_load_google_fonts() {
// Setup font arguments
$query_args = array(
@jqueryalmeida
jqueryalmeida / functions.php
Created May 8, 2017 14:38
Update json file after adding or updating a post in Wordpress
<?php
function fetchJSON( $post_id ) {
// Just for demo purpose, it's possible to fetch and pass data
$content = get_post_field('post_content', $post_id);
// open file
$open = curl_init();
curl_setopt($open, CURLOPT_URL, "https://mydomain.com/path/getContent.php?content=".$content);
curl_exec($open);
}
@jqueryalmeida
jqueryalmeida / detect-private-browsing.js
Created April 5, 2017 21:59 — forked from cou929/detect-private-browsing.js
Detect private browsing mode (InPrivate Browsing or Incognito).
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);