Skip to content

Instantly share code, notes, and snippets.

@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 / 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/
@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 / 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
*/
@tim-peterson
tim-peterson / partial.video.playlist.js
Last active December 20, 2015 22:09
video.playlist.js loop
//first version
// for continuous play
if(typeof options.continuous=='undefined' || options.continuous==true){
//console.log('options.continuous==true');
player.on("ended", function(){
//console.log('on ended');
index++;
@tim-peterson
tim-peterson / gist:6135384
Last active December 20, 2015 12:59
link tracking issue
PASSWORD gives email.onarbor.com
<?$base_url=base_url();?>
<p>Somebody (hopefully you) requested a new password for the Onarbor account for <?=$email_address?>.
To reset the password, follow this link:<p>
<p> <a href="<?=$base_url?>account/updatePassword/<?=$account_token?>/<?=$account_date?>">
<?=$base_url?>account/updatePassword/<?=$account_token?>/<?=$account_date?></a></p>
@tim-peterson
tim-peterson / nginx.conf
Created July 22, 2013 20:24
Make https mandatory without 301 redirect on Nginx using Strict-Transport-Security
http{
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/ssl/my_site.pem;
ssl_certificate_key /etc/ssl/my_site.key;
@tim-peterson
tim-peterson / videojs-playlist-youtube.js
Last active December 19, 2015 12:59
videojs-playlist.js modified to accept youtube url's
(function() {
videojs.plugin('playlist', function(options) {
//this.L="vjs_common_one";
if(typeof this.L!="undefined") var id=this.L;
//else workData.myPlayer.id=this.tag.id;
else var id=this.id_;
//console.log('begin playlist plugin with video id:'+id);
@tim-peterson
tim-peterson / gist:5610133
Created May 20, 2013 02:33
array object of thumbnails for video.js thumbnails plugin
var arr=[],
duration=100;
var num=duration/10;
var j=0;
var k=0;
for(var i=0; i<num; i++ ){
arr.push(k={'src': '/assets/js/'+j+'.png'});
j=j+5;
@tim-peterson
tim-peterson / gist:5136554
Last active December 14, 2015 19:28
nginx.conf to rewrite of example.com/sites/medicine to medicine.example.com
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
# worker_connections 768;
worker_connections 7680;
# multi_accept on;
}