Skip to content

Instantly share code, notes, and snippets.

@tim-peterson
tim-peterson / fixed read replica config
Created September 19, 2012 14:04
fixed read replica config
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Readreplica {
public function Readreplica(){
$config['hostname'] = "myReadReplica.com";
$config['username'] = "xxxxxx";
$config['password'] = "xxxxxx";
$config['database'] = "myDB";
@tim-peterson
tim-peterson / font-awesome.min.css
Created September 23, 2012 15:22
font-awesome.min.css
@font-face{font-family:'FontAwesome';src:url('../font/fontawesome-webfont.eot');src:url('../font/fontawesome-webfont.eot') format('embedded-opentype'),url('../font/fontawesome-webfont.woff') format('woff'),url('../font/fontawesome-webfont.ttf') format('truetype'),url('../font/fontawesome-webfont.svgz#FontAwesomeRegular') format('svg'),url('../font/fontawesome-webfont.svg#FontAwesomeRegular') format('svg');font-weight:normal;font-style:normal}[class^="icon-"],[class*=" icon-"]{display:inline;width:auto;height:auto;line-height:inherit;vertical-align:baseline;background-image:none;background-position:0 0;background-repeat:repeat}li[class^="icon-"],li[class*=" icon-"]{display:block}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:FontAwesome;font-weight:normal;font-style:normal;display:inline-block;text-decoration:inherit}a [class^="icon-"],a [class*=" icon-"]{display:inline-block;text-decoration:inherit}.icon-large:before{vertical-align:top;font-size:1.3333333333333333em}.btn [class^="icon-"],.btn [c
@tim-peterson
tim-peterson / UploadHandlerS3.php
Last active January 28, 2021 23:42
jQuery-File-Upload S3 PHP upload directly using AWS PHP SDK V2 (w/ optional Dropbox Chooser-selected files) https://github.com/blueimp/jQuery-File-Upload
<?php
use Aws\Common\Aws;
use Aws\S3\Exception\S3Exception;
// make sure the SDK is installed
// I've used Composer to autoload it: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/installation.html
/*
* jQuery File Upload Plugin PHP Class 7.1.0
* https://github.com/blueimp/jQuery-File-Upload
@tim-peterson
tim-peterson / Docverter PHP-CURL example
Last active November 28, 2019 12:57
Docverter PHP-CURL example
//set POST variables
$url = 'http://c.docverter.com/convert';
$fields = array('from' => 'markdown',
'to' => 'pdf',
'input_files[]' => "@/".realpath('markdown.md').";type=text/x-markdown; charset=UTF-8"
);
//open connection
$ch = curl_init();
@tim-peterson
tim-peterson / Go Revel nginx.conf
Last active March 10, 2018 04:10
Revel Framework nginx.conf to make Revel app work outside of localhost, i.e., on my live, personal-website.com
http{
index index.html;
server {
listen 80;
root /gocode/src/personalwebsiteapp;
server_name personal-website.com;
@tim-peterson
tim-peterson / jqueryui.autocomplete.js
Created October 27, 2012 14:28
jqueryui.autocomplete.js
/*!
* jQuery UI Autocomplete 1.8.20
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Autocomplete
*
* Depends:
@tim-peterson
tim-peterson / Remote Revel app access config
Last active February 3, 2017 18:41
Config to access Go Revel app remotely, i.e., by IP address or domain name (NOT localhost, or NOT 127.0.0.1)
## nginx.conf ##
server {
listen 80;
# listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
connection.query('SELECT * from schools where id > 4479 && id < 4490;', function(err, rows, fields) { // and id=35402
if (err) throw err;
var len =rows.length;
for(var i = 0; i < len; i++){
var school_name = rows[i].name;
var parent_org = rows[i].id;
@tim-peterson
tim-peterson / jquery.sparkline.mod.js
Created June 4, 2012 12:58
Modified jquery.sparkline.js-to attempt to make dynamic page loading to work, changed lines 375 and 586
/**
*
* jquery.sparkline.js
*
* v2.0
* (c) Splunk, Inc
* Contact: Gareth Watts (gareth@splunk.com)
* http://omnipotent.net/jquery.sparkline/
*
* Generates inline sparkline charts from data supplied either to the method
@tim-peterson
tim-peterson / jquery.validate.1.11.1.js
Created August 16, 2013 12:56
jquery.validate.1.11.1.js
/*!
* jQuery Validation Plugin 1.11.1
*
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
* http://docs.jquery.com/Plugins/Validation
*
* Copyright 2013 Jörn Zaefferer
* Released under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*/