Skip to content

Instantly share code, notes, and snippets.


Tyler Longren tlongren

View GitHub Profile
View gist:5548728
require 'path-to-Stripe.php';
if ($_POST) {
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
tlongren / index.php
Last active Dec 17, 2015
Stripe PHP Implementation from
View index.php
require 'stripe-php/lib/Stripe.php';
if ($_POST) {
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
tlongren / gist:5597049
Last active Dec 17, 2015 — forked from vshvedov/gist:1370650
Sublime Text 2 on Debian from PPA
View gist:5597049
sudo mv /usr/sbin/add-apt-repository
sudo chmod o+x /usr/sbin/add-apt-repository
sudo chown root:root /usr/sbin/add-apt-repository
sudo add-apt-repository ppa:webupd8team/sublime-text-2
tlongren /
Last active Dec 18, 2015
iptables firewall for VPS on Debian Squeeze
# This file will reset the firewall to allow everything.
# Set the default policy
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
tlongren / HEAD
Created Jun 10, 2013
FCC .git folder exposure
0000000000000000000000000000000000000000 94c673c713cd043bb8bf09961f079a5acd0e63b4 root <root@fcc-cms-test-1.domain.local> 1296617728 -0500
94c673c713cd043bb8bf09961f079a5acd0e63b4 7a90725d60bf2bc6e1c4239a441fc0f2f86de8c9 root <root@fcc-cms-test-1.domain.local> 1299516632 -0500 pull origin staging: Fast forward
7a90725d60bf2bc6e1c4239a441fc0f2f86de8c9 88f257ffd94f3ca1e9bd6874c436fd69b34c4394 root <root@fcc-cms-test-1.domain.local> 1299594428 -0500 pull origin staging: Fast forward
88f257ffd94f3ca1e9bd6874c436fd69b34c4394 a6896f37cf532f06c130c7b2cc8cb83cbb52004b root <root@fcc-cms-test-1.domain.local> 1300923087 -0400 pull origin staging: Fast forward
a6896f37cf532f06c130c7b2cc8cb83cbb52004b c605429aba8d28834869467cde53919598054613 root <root@fcc-cms-test-1.domain.local> 1300926414 -0400 pull origin staging: Fast forward
c605429aba8d28834869467cde53919598054613 a66e9e81c462f7ced571cd91bd43744d14451edc root <root@fcc-cms-test-1.domain.local> 1300976836 -0400 pull origin staging: Fast forward
tlongren / checkAPI.php
Created Jun 19, 2013
Check if API url is online before proceeding with calls to said API
View checkAPI.php
$checkapi = (@fsockopen("", 443, $errno, $errstr, 0.4) ? "up" : "down");
echo $checkapi;
View ajax-form.js
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
tlongren / checkForString.php
Created Jun 27, 2013
My favorite method for checking for the existence of a string in a variable
View checkForString.php
$status = (strpos($_SERVER['REQUEST_URI'],'my-page') ? 'active' : 'notactive');
tlongren / error_log
Created Jun 28, 2013
Stripe apache error_log
View error_log
[Fri Jun 28 17:11:59 2013] [error] [client] PHP Fatal error: Uncaught exception 'Stripe_InvalidRequestError' with message 'You must supply a valid card' in /srv/www/\nStack trace:\n#0 /srv/www/ Stripe_ApiRequestor->handleApiError('{? "error": {?...', 400, Array)\n#1 /srv/www/ Stripe_ApiRequestor->_interpretResponse('{? "error": {?...', 400)\n#2 /srv/www/ Stripe_ApiRequestor->request('post', '/v1/customers', Array)\n#3 /srv/www/ Stripe_ApiResource::_scopedCreate('Stripe_Customer', Array, NULL)\n#4 /srv/www/ Stripe_Customer::create(Array)\n#5 {main}\n thrown in /srv/www/
tlongren / addOrder.js
Last active Dec 19, 2015
Add New Subscription. This is broken code, so please do not use it for a implementation. It's here for reference purposes only.
View addOrder.js
var stripeResponseHandler = function(status, response) {
if (response.error) {
// re-enable the submit button
// show the errors on the form
} else {
var form$ = $("form#addservice-form");