Skip to content

Instantly share code, notes, and snippets.

View tlongren's full-sized avatar
🎯
Focusing

Tyler Longren tlongren

🎯
Focusing
View GitHub Profile
@tlongren
tlongren / mysql-health.sh
Last active August 29, 2015 14:19 — forked from alexalouit/mysql-health.sh
Check And Repair All MySQL Databases on Debian And Ubuntu Linux
#!/bin/sh
#
# cron ex: 0 0 1 * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /home/tyler/mysql-health.sh >> /home/tyler/mysql-health.log
mysqlcheck --defaults-file=/etc/mysql/debian.cnf --auto-repair --optimize --all-databases
<?php
/**
* Plugin Name: Email Confirmation
* Description: Send an email to the user with confirmation code and store form data in database until user confirms.
* Author: Cedric Ruiz
*/
class EmailConfirmation
{
const PREFIX = 'email-confirmation-';
<?php
define('PAPERTRAIL_PORT','123456');
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, 'logs.papertrailapp.com', PAPERTRAIL_PORT);
}
socket_close($sock);
}
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@tlongren
tlongren / gist:5597049
Last active December 17, 2015 10:48 — forked from vshvedov/gist:1370650
Sublime Text 2 on Debian from PPA
wget http://blog.anantshri.info/content/uploads/2010/09/add-apt-repository.sh.txt
sudo mv add-apt-repository.sh.txt /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
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("STRIPE_API_KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");