Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Matt Thomas betweenbrain

💭
I may be slow to respond.
View GitHub Profile
@betweenbrain
betweenbrain / simple-promise-retry.js
Created Jan 27, 2017 — forked from briancavalier/simple-promise-retry.js
A few general patterns for retries using promises
View simple-promise-retry.js
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);
View README.md

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

View EncryptTest.php
<?php
$con = mysql_connect('localhost', 'dbUser', 'dbPassword');
$key = '1234567890123456';
$table = "CREATE TABLE people (
id INT NOT NULL AUTO_INCREMENT,
full_name VARCHAR(255),
ssn VARCHAR(255),
PRIMARY KEY (id)
View jdatabase.md

Here is an example of write subquery in Joomla! 3 using JDatabase method.

<?php
// Initialize variables.
$db       = JFactory::getDbo();
$subQuery = $db->getQuery(true);
$query    = $db->getQuery(true);

// Create the base subQuery select statement.
View MYDB.cnf
[client]
host=
user=
password=
database=
View gist:1731407
AddDefaultCharSet utf-8
DefaultLanguage en-US
# Activate rewrite engine
Options +FollowSymLinks
RewriteEngine on
# Redirect to wwww
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]