Skip to content

Instantly share code, notes, and snippets.

View travist's full-sized avatar

Travis Tidwell travist

View GitHub Profile
@travist
travist / README.md
Last active July 3, 2022 23:25
Installing Form.io on Ubuntu Server

Installing Form.io Enterprise on Ubuntu Sever

This is a complete installation script of a standalone Form.io server within Ubuntu Server. You must upgrade one of your Form.io projects to Enterprise to get this working.

@travist
travist / payment.html
Last active August 3, 2018 17:37
Form.io + Stripe Payment Processing
<div ng-controller="StipePayment">
<formio form="form" submission="submission"></formio>
</div>
@travist
travist / create.js
Last active February 15, 2018 14:43
Form.io Server-to-Server User Creation and Authentication
var request = require("request");
// The api key is generated within the Form.io project settings.
var apiKey = '23kj2k3jhkj2h3';
// Create a new user.
request({
method: 'POST',
url: 'https://example.form.io/user/submission',
headers: {
@travist
travist / render-complete.js
Last active May 25, 2016 18:45
Trigger event on Form Rendering completed
angular.controller('renderComplete', [
'$scope',
'FormioUtils',
function(
$scope,
FormioUtils
) {
var renderComplete = function() {
$scope.$emit('formRenderComplete');
};
@travist
travist / app.js
Created May 20, 2016 01:16
Auto Login/Register from Form Submission with Form.io
// Bind to the submission of the form.
$rootScope.$on('formSubmission', function (event, submission) {
if (!submission) {
return;
}
// See if this is a new user or existing.
$http.get(AppConfig.appUrl + '/user/exists', {
params: {
'data.email': submission.data.email
@travist
travist / node-middleware.js
Created January 28, 2016 03:40
Form.io Node.js Remote Middleware Binding
var formio = require('formio-service')();
var Project = formio.Project;
// First authenticate.
formio.authenticate('test@example.com', 'password').then(function() {
// Create a new project instance.
var project = new project('https://myapp.form.io');
// Bind to a form.
@travist
travist / middleware.js
Last active June 6, 2020 02:29
Remote Middleware Example
module.exports = function(req, next) {
// Append .example.com to emails for testing purposes...
req.body.data.email += '.example.com';
next(null);
};
@travist
travist / selfdescriptivenum.js
Created January 9, 2016 02:41
Self Descriptive number solution
for (var i = 0; i < 9999999999; i++) {
var num = ("0000000000" + i).substr(-10,10);
var counts = [0,0,0,0,0,0,0,0,0,0];
for (var j = 0; j < 10; j++) {
counts[num[j]]++;
}
if (counts.join('') === num) {
console.log('Winner!' + num);
break;
}
@travist
travist / middleware.js
Last active January 28, 2016 03:22
install.md
npm install -g formio/formio-cli#master
formio bind POST https://myapp.form.io/myform ./middleware.js
@travist
travist / timezones.json
Created July 30, 2015 15:23
Microsoft API TimeZones
[
{
"timezone": "Afghanistan Standard Time",
"display": "(GMT+04:30) Kabul"
},
{
"timezone": "Alaskan Standard Time",
"display": "(GMT-09:00) Alaska"
},
{