Skip to content

Instantly share code, notes, and snippets.

View andrei-tofan's full-sized avatar

Andrei Tofan andrei-tofan

View GitHub Profile
@andrei-tofan
andrei-tofan / ninja-forms.js
Last active June 25, 2020 09:06
Ninja Forms JavaScript Hook
var form_id = 3;
// listen to all ajax completed events
jQuery(document).ajaxComplete(function (event, jqXHR, ajaxOptions) {
// try to parse response
var data = JSON.parse(jqXHR.responseText || '{}');
// check if the ajax request is for our form
if (data.data.form_id == form_id) {
@andrei-tofan
andrei-tofan / beefree.js
Created March 1, 2017 20:58
Fetch access token from beefree api
/**
* NodeJS beefree.io integration
*/
const https = require('https');
const querystring = require('querystring');
/**
* Fetch access token from beefree api
*/
@andrei-tofan
andrei-tofan / example.js
Last active February 29, 2024 23:59
node.js writable buffer stream (pdfkit example)
/**
* Convert PDFDocument to Base64
*/
const PDFDocument = require('pdfkit');
const stream = require('./stream');
// crate document and write stream
let doc = new PDFDocument();
let writeStream = new stream.WritableBufferStream();