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
| // MultiExporter.jsx | |
| // Version 0.1 | |
| // Version 0.2 Adds PNG and EPS exports | |
| // Version 0.3 Adds support for exporting at different resolutions | |
| // Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize | |
| // Version 0.5 Fixed cropping issues | |
| // Version 0.6 Added inner padding mode to prevent circular bounds clipping | |
| // | |
| // Copyright 2013 Tom Byrne | |
| // Comments or suggestions to tom@tbyrne.org |
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 _gaq = _gaq || []; | |
| _gaq.push(['_setAccount', YOUR_URCHIN_CODE]); | |
| _gaq.push(['_trackPageview']); | |
| _gaq.push(['_trackPageLoadTime']); | |
| (function () { | |
| function loadDeferredScripts() { | |
| window.setTimeout(function () { | |
| var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
| ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
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 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); |
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 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); | |
| } |
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_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( |
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
| /* | |
| 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; |
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 | |
| /** | |
| * Template Name: ajax | |
| */ | |
| ?> | |
| <?php | |
| $post = get_post($_GET['id']); | |
| ?> | |
| <?php if ($post) : ?> | |
| <?php setup_postdata($post); ?> |
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 | |
| /* 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 ); |
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
| // 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 |