The trick is to only register the listener for events that indicate failure, namely
- PROCESS_STATE_STOPPED
- PROCESS_STATE_EXITED
- PROCESS_STATE_FATAL
Once they do, we should send a SIGQUIT to Supervisor.
| import superagent from 'superagent'; | |
| import merge from 'lodash/merge'; | |
| import { camelizeKeys, decamelizeKeys } from 'humps'; | |
| import config from 'config'; | |
| const CALL_API = Symbol.for('Call API'); | |
| /** | |
| * Prepare headers for each request and include the token for authentication. | |
| * @param {Boolean} token Authentication token |
| /** | |
| * Run this with `babel-node generateSVG.js` | |
| */ | |
| import fs from 'fs'; | |
| import path from 'path'; | |
| import { Readable } from 'stream'; | |
| import childProcess from 'child_process'; | |
| import phantomjs from 'phantomjs'; | |
| import im from 'imagemagick'; | |
| import tmp from 'tmp'; |
| var crypto = require("crypto"); | |
| var SECRET_KEY = 'MY_AWS_SECRET_KEY'; | |
| var POLICY_JSON = { | |
| "expiration": "2030-12-01T12:00:00.000Z", | |
| "conditions": [ | |
| {"bucket": "my-bucket-name"}, | |
| ["starts-with", "$key", ""], | |
| {"acl": "public-read"}, | |
| ["starts-with", "$Content-Type", ""], |
| import fs from 'fs'; | |
| import path, { resolve } from 'path'; | |
| import assert from 'assert'; | |
| import Module from 'module'; | |
| import jsdom from 'jsdom'; | |
| import Mocha from 'mocha'; | |
| import chokidar from 'chokidar'; | |
| import { isMatch } from 'micromatch'; | |
| import log from 'fancy-log'; | |
| import async from 'async'; |
| import fs from 'fs'; | |
| import path, { resolve } from 'path'; | |
| import assert from 'assert'; | |
| import Module from 'module'; | |
| import jsdom from 'jsdom'; | |
| import Mocha from 'mocha'; | |
| import chokidar from 'chokidar'; | |
| // Let's import and globalize testing tools so | |
| // there's no need to require them in each test |
This is a simplified showcase of how you can easily build your own Optin form in WordPress.
It can connect to any API that supports cURL (most of them do). There is no error reporting implemented. It uses exit intent detection script called Ouibounce, which needs to be enqueued in your functions.php
See the tutorial here: How to build your own WordPress email form
| var myWidgets = myWidgets || {}; | |
| // Model for a single testimonial | |
| myWidgets.Testimonial = Backbone.Model.extend({ | |
| defaults: { 'quote': '', 'author': '' } | |
| }); | |
| // Single view, responsible for rendering and manipulation of each single testimonial | |
| myWidgets.TestimonialView = Backbone.View.extend( { |
| <?php | |
| class acf_field_gravity_forms extends acf_field { | |
| function __construct() { | |
| $this->name = 'gravity_forms_field'; | |
| $this->label = __( 'Gravity Forms', 'acf' ); | |
| $this->category = __( "Relational", 'acf'); | |
| $this->defaults = array( | |
| 'multiple' => 0, |
| function register_watermarked_size() { | |
| add_image_size( 'watermarked', 550, 550, true ); // This is what should be uploaded | |
| } | |
| add_action( 'init', 'register_watermarked_size' ); | |
| class Watermark_Image { | |
| // The attachment meta array | |
| public $meta = array(); |