Skip to content

Instantly share code, notes, and snippets.

@tnog
tnog / reveal_ajax.js
Last active December 18, 2015 19:29 — forked from jeduan/reveal_ajax.js
(function($) {
$.fn.displayPost = function() {
event.preventDefault();
var post_id = $(this).data("id");
var id = "#" + post_id;
// Check if the reveal modal for the specific post id doesn't already exist by checking for it's length
if($(id).length == 0 ) {
// We'll add an ID to the new reveal modal; we'll use that same ID to check if it exists in the future.
@tnog
tnog / gist:5834404
Last active December 18, 2015 19:39
<?php
/*
Plugin Name: Sketchbook Plugin
Plugin URI: http://takahironoguchi.com
Description: A custom tumblr style wall plugin. Requires installation of Elliot Condon's ACF plugin: www.advancedcustomfields.com. And uses sy4mil's Aqua-Resizer https://github.com/sy4mil/Aqua-Resizer
Version: 1.0
Author: Takahiro Noguchi
Author URI: http://takahironoguchi.com/
License: GPLv2
License: GPLv2 or later
(function($) {
// Create custom plugin to handle AJAX queries and to build containers
$.fn.displayPost = function() {
$(this).click(function(event){
event.preventDefault();
// grabs the id for the target post
var post_id = $(this).data("id");
// We'll define the div id for the container here
var id = "#" + post_id;
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($ch, CURLOPT_USERPWD, $apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@tnog
tnog / Tracker.js
Created July 7, 2016 21:04 — forked from juriansluiman/Tracker.js
Track outbound links and form submits with Google Analytics Universal code
/**
* Create a Tracker module for Google Analytics
*
* This tracker enables to track clicks on links and submits on forms. Usually
* these events will not be recorded as the window.location is changed and the
* request to Google Analytics is cancelled. This module prevents default
* behaviour, tracks the Google Analytics event and then continues the link/submit.
*
* Data attributes are used to augment the event with category/action/label values.
* Use them as "data-track-category", "data-track-action" and "data-track-label".
@tnog
tnog / customer_registration_email_alert.php
Created March 30, 2017 05:08
WooCommerce: Send a custom admin email when a new customer creates a new account.
<?php
namespace Your\Custom\Namespace;
/**
* Send a custom admin email when a new customer creates a new account.
* @param integer $user_id The ID of the user whose data should be retrieved.
* @return [type] [description]
*/
function customer_registration_email_alert( $user_id ) {
<?php
namespace To4Framework;
if (!defined('ABSPATH')) {
exit;
}
/**
* Wrapper class to display admin and debug.log messages.
<?php
namespace To4Framework;
if (!defined('ABSPATH')) {
exit;
}
class CachingAds extends Caching
{
<?php
/**
* Clears entire WP Engine cache
* @return void
*/
public function wpeCacheFlush() {
// Only initiates a cache clear if the $cleared property is false
if (!self::$cleared) {
@tnog
tnog / wordpress-block-placeholder.html
Last active November 12, 2022 00:11
WordPress Block Dummy Content
<!-- wp:heading {"level":1} -->
<h1>This is a heading (H1)</h1>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>This is a heading (H2)</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3>This is a heading (H3)</h3>