Skip to content

Instantly share code, notes, and snippets.

@jaredk2g
jaredk2g / gist:5385663
Created April 15, 2013 04:13
Output from attempting to deploy sails.js app to nodejitsu
info: Starting app inspirevive
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error:
error: There was an error while attempting to start the app
error: Error spawning drone
error: Script took too long to listen on a socket
error:
error: This type of error is usually a user error.
error: Error output from app:
@jaredk2g
jaredk2g / gist:5388078
Created April 15, 2013 13:33
sails.js with redis session adapter
Error: Cannot find module './blueprints/error'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Volumes/HDD/Users/jared/Documents/Code/node/inspirevive/node_modules/sails/lib/configuration/express.js:40:4)
at Object.handle (/Volumes/HDD/Users/jared/Documents/Code/node/inspirevive/node_modules/sails/node_modules/express/lib/http.js:192:10)
at next (/Volumes/HDD/Users/jared/Documents/Code/node/inspirevive/node_modules/sails/node_modules/express/node_modules/connect/lib/http.js:199:17)
at next (/Volumes/HDD/Users/jared/Documents/Code/node/inspirevive/node_modules/sails/node_modules/express/node_modules/connect/lib/http.js:201:11)
at next (/Volumes/HDD/Users/jared/Documents/Code/node/inspirevive/node_modules/sails/node_modules/express/node_modules/connect/lib/http.js:201:11)
@jaredk2g
jaredk2g / gist:5390099
Created April 15, 2013 18:15
Output from jitsu --deploy with sails.js
prompt: Is this ok?: (yes)
info: Creating snapshot 0.0.0-23
debug: { method: 'POST',
debug: uri: 'https://api.nodejitsu.com/apps/jaredtking/inspirevive/snapshots/0.0.0-23',
debug: headers:
debug: { Authorization: '*********************************************************************',
debug: 'Content-Type': 'application/octet-stream',
debug: 'Content-Length': 1523463 },
debug: timeout: 240000,
debug: rejectUnauthorized: false }
@jaredk2g
jaredk2g / email-error-logs.sh
Created July 28, 2013 22:09
Bash script to e-mail errors that show up in my nginx error log since the previous day
#!/bin/bash
SITES=( dev.inspirevive.com invoicedapp.com invoice-generator.com infuse.jaredtking.com jaredtking.com printable-calendar.co )
DATE_FORMAT="+%Y/%m/%d"
YESTERDAY=$(date --date="yesterday" $DATE_FORMAT)
TODAY=$(date $DATE_FORMAT)
function parseLog {
NUM_ERRORS=0
#!/usr/bin/php
<?php
/**
* .git/hooks/pre-commit
*
* This pre-commit hooks will check for PHP error (lint), and make sure the code
* is PSR compliant.
*
* Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer)
*
@jaredk2g
jaredk2g / README.md
Created July 27, 2015 22:37
Invoiced Ruby Client

Invoiced API Ruby Client

The example.rb file has examples for performing various tasks on the API, like creating customers, invoicing, and recording payments.

Installation

The invoiced gem needs to be installed first with:

gem install invoiced
@jaredk2g
jaredk2g / lookup_accounts_with_credits.rb
Created May 26, 2016 22:25
Lookup accounts with credits on Invoiced
require 'invoiced'
invoiced = Invoiced::Client.new('your_api_key')
more = true
page = 1
while more do
# Fetch a page of customers with a credit balance
customers, metadata = invoiced.Customer.list(
:balance => true,
@jaredk2g
jaredk2g / SSO.cs
Created July 25, 2016 21:59
Invoiced C#.NET Single Sign-On Example
using Jose.JWT;
using System;
using System.Text;
public class SSO
{
public static void Main()
{
// Depends on this JWT library: https://github.com/dvsekhvalnov/jose-jwt
@jaredk2g
jaredk2g / events.php
Last active September 12, 2016 21:29
List the events for an invoice on Invoiced (PHP)
<?php
// prerequisite: run "composer require invoiced/invoiced"
require 'vendor/autoload.php';
$invoiced = new Invoiced\Client('TODO_INSERT_API_KEY');
$objectType = 'invoice';
$invoiceId = 'TODO_INSERT_INVOICE_ID';
@jaredk2g
jaredk2g / get_subscription_approvals.py
Created January 30, 2017 22:18
Gets list of subscription approvals from Invoiced
import invoiced
client = invoiced.Client('_YOUR_API_KEY_')
subscriptions, metadata = client.Subscription.list(per_page=1000, expand="customer")
for subscription in subscriptions:
if (subscription.approval):
print(subscription.customer['name']+" approved "+subscription.plan+" from IP: "+subscription.approval['ip'])