Skip to content

Instantly share code, notes, and snippets.

@brettcvz
brettcvz / docs
Created November 16, 2012 21:28
Filepicker.io Heroku addon instructions
[Filepicker.io](http://addons.heroku.com/filepicker) provides file uploading and content management for developers as an [add-on](http://addons.heroku.com) for Heroku.
Filepicker.io excels any time you want to add uploading or cloud file integration into your application. Worried about running into the Heroku 30-second-timeout with big files? No worries, we can handle files upward of 100GB. Need to store them on S3? Done, no questions asked.
Even better, Filepicker.io provides:
* Integration with 17 content providers, so your users can pull in content directly from the cloud, increasing their engagement in your application. No wrestling with APIs required - one line of code and your app is set up with Dropbox, Facebook Photos, Google Drive, Instagram, and many more.
* Powerful image processing functionality, so you can take uploads from the user and crop them to a 128x128 profile pictured centered around their face, for example
* Stellar performance, streaming large files in parallel at speeds 4-10 times
@brettcvz
brettcvz / Hn Point scraper
Last active December 11, 2015 11:48
Simple webserver that takes in a hn story id and returns the points of the story. Has no error handling
import web
from pyquery import PyQuery as pq
import re
urls = (
'/(.*)', 'hn'
)
app = web.application(urls, globals())
@brettcvz
brettcvz / debugger.js
Last active December 13, 2015 21:08
Using debugger in javascript
(function(){
var time = +new Date;
//no idea what that did, let's check it out
debugger;
//Pretty cool - you can modify the local variables as well via the web inspector
alert(time);
})();
@brettcvz
brettcvz / base template.html
Last active December 15, 2015 06:09
Base HTML template for Filepicker.io and Zencoder integration
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
lang="en-US">
<head>
<meta http-equiv="content-type" content="text/html;
charset=utf-8" />
<title>Zencoder Dropzone</title>
<!-- jQuery Include -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- Filepicker.io Include -->
@brettcvz
brettcvz / fpio_starter.html
Created March 21, 2013 15:59
Starter script for using Filepicker.io
<!-- Add this just before the </head> tag -->
<script type="text/javascript">
$(function() {
//Put your Filepicker.io API key here:
filepicker.setKey('A9gfeq0CMTMeP1dR86vcxz');
$('a').click(function(e) {
e.preventDefault(); // This keeps the normal link
// behavior from happening
filepicker.pickAndStore({},{location: 's3'},
function(fpfiles){
@brettcvz
brettcvz / fpio_zencoder.html
Created March 21, 2013 16:00
Full js for integrating filepicker.io and zencoder
<!-- Replace the previous script tag with this one -->
<script type="text/javascript">
$(function() {
//Put your Filepicker.io API key here:
filepicker.setKey('A9gfeq0CMTMeP1dR86vcxz');
//Zencoder API key
var zenKey = 'ce887203717c4417267eeb7b59b55885';
$('a').click(function(e) {
e.preventDefault(); // This keeps the normal link behavior from happening
//Specifying all the extensions that zencoder can handle, you may want to choose a subset
@brettcvz
brettcvz / gist:6197978
Created August 9, 2013 22:53
Ink filepicker + Jcrop example
$(function(){
var jcrop_api;
var changeCrop = function(c){
//alert(c.w);
var url = $('#convert_url_link').attr('href');
var cropparams = [Math.floor(c.x),Math.floor(c.y),Math.floor(c.w),Math.floor(c.h)].join();
newurl = url.replace(/crop=[0-9]+,[0-9]+,[0-9]+,[0-9]+/, 'crop='+cropparams);
$('#convert_url_link').attr('href', newurl );
$('#process-image-thumb').attr('src', newurl );
@brettcvz
brettcvz / gm-composite.js
Created September 26, 2013 21:31
Node gm composition
//To use this, in another file call
//require("./gm-composite.js")(gm.prototype);
//You can then do gm("baseImage.png").composite(gm("watermark.png"), "SouthEast", function(err, composite_gm_obj){...});
var gm = require('gm');
var randInt = function(min, max) {
return Math.floor(min + (Math.random() * (max-min)));
};
@brettcvz
brettcvz / Server.sh
Last active December 31, 2015 23:49
Audio streaming teleportation
pacat -r -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor | ncat -k --send-only -l -p 1337 > server_output.txt &
ssh -R 1339:localhost:1337 hopscotch.inkmobility.com &
@brettcvz
brettcvz / gist:9279647
Created February 28, 2014 20:51
Keybase proof
### Keybase proof
I hereby claim:
* I am brettcvz on github.
* I am brettcvz (https://keybase.io/brettcvz) on keybase.
* I have a public key whose fingerprint is D7C1 CB53 CFA5 D6C8 3856 ECA8 0784 1CD7 F723 9F7C
To claim this, I am signing this object: