Flatdoc is a small JavaScript file that fetches Markdown files and renders them as full pages. Essentially, it’s the easiest way to make open source documentation from Readme files.
When performing tasks using the Gravity Forms API, handling notifications and hook execution on demand is something that becomes really handy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
<?php trait GravityForm{ function GravityForm_send_notifications($form_id, $entry_id){ // Get the array info for our forms and entries // that we need to send notifications for $form = RGFormsModel::get_form_meta($form_id); $entry = RGFormsModel::get_lead($entry_id); // Loop through all the notifications for the // form so we know which ones to send $notification_ids = array(); foreach($form['notifications'] as $id => $info){ array_push($notification_ids, $id); } // Send the notifications GFCommon::send_notifications($notification_ids, $form, $entry); } function GravityForm_execute_hooks($form_id, $entry_id){ $form = GFAPI::get_form( $form_id ); $entry = GFAPI::get_entry( $entry_id ); $registered_addons = GFAddOn::get_registered_addons( ); foreach( $registered_addons as $reg){ if(method_exists($reg, "get_instance")){ $execute = $reg::get_instance(); foreach($registered_addons as $addon){ $execute->maybe_process_feed( $entry, $form); } } } return true; } } |
Sticky-kit provides an easy way to attach elements to the page when the user scrolls such that the element is always visible.
1 2 3 4 5 6 7 |
$("#sticky_item").stick_in_parent() .on("sticky_kit:stick", function(e) { console.log("has stuck!", e.target); }) .on("sticky_kit:unstick", function(e) { console.log("has unstuck!", e.target); }); |
Visual Composer shortcodes are normally not converted within the WordPress REST API rendered output.
This can be accomplished by calling WPBMap::addAllMappedShortcodes();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
add_action( 'rest_api_init', function () { register_rest_field( 'page', 'content', array( 'get_callback' => 'convert_do_shortcodes', 'update_callback' => null, 'schema' => null, ) ); }); function convert_do_shortcodes( $object, $field_name, $request ) { WPBMap::addAllMappedShortcodes(); // This does all the work global $post; $post = get_post ($object['id']); $output['rendered'] = apply_filters( 'the_content', $post->post_content ); return $output; } |
onmount allows you to detect when a DOM element appears and when it exits. No dependencies!
1 2 3 4 5 6 7 |
onmount = require('onmount') onmount('.push-button', function () { $(this).on('click', function () { alert('working...') }) }) |
Player.js is a library that allows you to programmatically control video and audio within iFrames across a number of services.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
var player = new playerjs.Player('iframe'); player.on('ready', function(){ player.on('play', function(){ console.log('play'); }); player.getDuration(function(duration){ console.log(duration); }); if (player.supports('method', 'mute')){ player.mute(); } player.play(); }); |
„Schema.org is a collaborative, community activity with a mission to create, maintain, and promote schemas for structured data on the Internet, on web pages, in email messages, and beyond.“
This shared vocabulary from Google, Bing and Yahoo helps to understand your content!
This shows how to associate your logo with your organization.
1 2 3 |
<a href="http://www.yoursite.com/"> <img src="http://www.yoursite.com/your_logo.jpg" alt="Your logo" /> </a> |
1 2 3 4 5 |
<div itemscope itemtype="http://schema.org/Organization"> <a itemprop="url" href="http://www.yoursite.com/"> <img itemprop="logo" src="http://www.yoursite.com/yourlogo.jpg" alt="Your wonderful logo"/> </a> </div> |
Clients: Facebook Messenger, Twillio, Twitter, WebSocket :)
1 2 3 4 5 6 7 8 9 |
import Bottr from 'bottr'; let Bot = new Bottr.Bot() bot.on('message_received', (message, session) => { session.send('Hello World!') }) bot.listen() |
„Copying text to the clipboard shouldn’t be hard. It shouldn’t require dozens of steps to configure or hundreds of KBs to load. But most of all, it shouldn’t depend on Flash or any bloated framework. That’s why clipboard.js exists.“
SpinThatShit is a set of SCSS mixins for single element loaders and spinners.
1 |
<div class="your-loader"></div> |
1 2 3 |
.your-loader { @include loader09($size: 10px, $height: 48px, $gap: 8px, $duration: 1s, $align: middle); } |