Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View viccherubini's full-sized avatar
🚀
Zooming

Vic Cherubini viccherubini

🚀
Zooming
View GitHub Profile
@viccherubini
viccherubini / javascript.js
Created March 10, 2014 21:39
Testable JavaScript
(function($app, $jQuery) {
"use strict";
var CampaignGroupCollection = function(options) {
this.init(options);
};
CampaignGroupCollection.prototype.init = function(options) {
this.collection = options.collection;
this.campaignGroups = [];
@viccherubini
viccherubini / curl.php
Last active August 29, 2015 13:57
PHP cURL oddness
<?php
// This fails, but only on staging (DigitalOcean) server.
// Works fine on production (Linode) server.
// Please ignore bad security practices.
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://server.com:2143');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_POSTFIELDS, '<CommandQuery/>');
@viccherubini
viccherubini / phinx.yml.template
Created June 18, 2014 18:27
Phinx sample configuration
paths:
migrations: %%PHINX_CONFIG_DIR%%/../migrations
environments:
default_migration_table: _migrations
default_database: test
prod:
adapter: pgsql
host: "@@DB_SETTINGS_HOST@@"
name: "@@DB_SETTINGS_DATABASE@@"
@viccherubini
viccherubini / Histogram.php
Last active August 29, 2015 14:21
Histogram.php
<?php
class Histogram
{
/** @var array */
private $buckets = [];
/** @var integer */
private $count = 0;
Neat! I posted a link to my s3backup utility to HackerNews at the announcement that codinghorror.com had lost everything. I pointed how simple it was to use my utility (or any of them) to quickly and easily backup your databases and files.
Using s3backup, you can tar up your entire vhosts directory, or push each database dump to s3. It's insanely cheap. You can store 30gb, upload 30gb and download 30gb a month for $10. And chances are, you won't be downloading anything, so its even less than that.
s3backup also requires that the database is encrypted before it will work, so you have to have gpg installed.
Also, ensure that the files you're pushing are marked private. This ensures they can't be publicly downloaded.
I noticed I had some followers now, which is pretty neat. It also opens me up to scrutiny, but thats great, it'll only make my software better.
#!/usr/bin/perl -w
use strict;
my $found_error = 0;
sub msg {
my $msg = shift @_;
print $msg . "\n";
}
<?xml version="1.0"?>
<project name="IONCart" description="Advanced Shopping Cart" default="build" >
<target name="clean">
<delete file="./lib/configure.php" />
</target>
<target name="githooks">
<exec command="ln -s ../../hooks/pre-commit" dir=".git/hooks" />
</target>
<?php
require_once 'Artisan/Db.php';
require_once 'Artisan/Exception.php';
$db_config = array(
'server' => 'localhost',
'username' => 'username',
'password' => 'password',
'database' => 'dbname'
<?php
require_once 'Artisan/Db.php';
require_once 'Artisan/Exception.php';
$db_config = array(
'server' => 'localhost',
'username' => 'username',
'password' => 'password',
'database' => 'dbname'
<?php
require_once 'Artisan/Db.php';
require_once 'Artisan/Exception.php';
$db_config = array(
'server' => 'localhost',
'username' => 'username',
'password' => 'password',
'database' => 'dbname'