Skip to content

Instantly share code, notes, and snippets.

View corbanb's full-sized avatar

corban baxter corbanb

View GitHub Profile
@corbanb
corbanb / bash_commands.txt
Created July 7, 2014 20:33
helpful bash commands
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty.
* '!!:n' selects the nth argument of the last command, and '!$' the last arg
@corbanb
corbanb / lsof-3000.sh
Created June 18, 2014 20:55
list open processes on port
# useful for rails server already running message
lsof -wni tcp:3000
@corbanb
corbanb / api_cache.php
Created June 2, 2014 20:22
Simple API caching with PHP
<?php
/**
* API Request Caching
*
* Use server-side caching to store API request's as JSON at a set
* interval, rather than each pageload.
*
* @arg Argument description and usage info
*/
@corbanb
corbanb / README.md
Last active August 29, 2015 14:00
Simple method for subscribing and unsubscribing up users in Exact Target using the SOAP API w/ the savon gem

Thanks @MichaelAllenClark for the help with his examples. Not sure why this info wasn't on the code.exacttarget.com website to begin with.

@corbanb
corbanb / developer-resources.md
Last active May 17, 2016 08:25
Creative Developer Resources
@corbanb
corbanb / developer-setup.md
Last active August 29, 2015 13:59 — forked from saetia/gist:1623487
OSX - PHP/Ruby/Node - Developer Setup
@corbanb
corbanb / cron.php
Created March 3, 2014 20:44
Backup database to S3 bucket
<?php
$date = date("Y-m-dTH:i:s");
$file = 'db.backup.' . $date . '.sql.gz';
error_log("Database Backup Started - " . $file);
exec('touch ' . $file);
exec('chmod 600 ' . $file);
exec('mysqldump -u user --password="password" --add-drop-table --single-transaction database_name | gzip > ' . $file);
@corbanb
corbanb / default.conf
Last active May 23, 2020 12:22
Nginx redirect assets to CDN from Wordpress
server {
## Your website name goes here.
server_name domainname.com www.domainname.com _;
## Your only path reference.
root /var/www/;
listen 8080;
## This should be in your http block and if it is, it's not needed here.
index index.html index.htm index.php;
include conf.d/drop;
var App = App || {};
App.Helpers = App.Helpers || {};
(function($) {
'use strict';
App.Helpers.Numbers = {
@corbanb
corbanb / csv_to_html.php
Created January 10, 2014 00:23
Output CSV data into HTML with this simple script.
<?php
ini_set('auto_detect_line_endings',TRUE);
$handle = fopen("mydata.csv", "r");
?>
<ul>
<?php while ( ($data = fgetcsv($handle, 1000, ",")) !== FALSE ): ?>
<li>
<a href="<?= $data[4] ?>" class="product-container">
<img class="lazy" src="<?= $data[3] ?>" data-original="<?= $data[3] ?>">
<div class="post-details">