Skip to content

Instantly share code, notes, and snippets.

View tshaddix's full-sized avatar

Tyler Shaddix tshaddix

View GitHub Profile
@mattlockyer
mattlockyer / client.js
Last active February 22, 2023 18:30
s3 upload as stream using req stream (extra info in request header)
const file = this.input.files[0];
//console.log(file);
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', (e) => {
console.log(e.target.response);
});
xhr.open('POST', host + 'fileuploadstream', true);
xhr.setRequestHeader('body', JSON.stringify({ id: 'somebucketfolderid', fn: file.name }));
xhr.send(file);
@drewolson
drewolson / reflection.go
Last active November 20, 2023 09:39
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@pzaich
pzaich / gist:3997914
Created November 2, 2012 00:48
install graphicsmagick to EC2
wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.15.tar.gz
tar -xvf GraphicsMagick-1.3.15.tar.gz
cd GraphicsMagick-1.3.15
./configure
make
@aheckmann
aheckmann / storeImgInMongoWithMongoose.js
Created April 17, 2012 19:14
store/display an image in mongodb using mongoose/express
/**
* Module dependencies
*/
var express = require('express');
var fs = require('fs');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// img path
@mikeal
mikeal / gist:1840641
Created February 16, 2012 01:33
get a new/clean port with node.js
var portrange = 45032
function getPort (cb) {
var port = portrange
portrange += 1
var server = net.createServer()
server.listen(port, function (err) {
server.once('close', function () {
cb(port)
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@jamiew
jamiew / google_twunter_lol
Created July 28, 2011 20:34
All the dirty words from Google's "what do you love" project: http://www.wdyl.com/
easterEgg.BadWorder.list={
"4r5e":1,
"5h1t":1,
"5hit":1,
a55:1,
anal:1,
anus:1,
ar5e:1,
arrse:1,
arse:1,
@justmoon
justmoon / bintest.js
Created July 14, 2011 15:22
MongooseJS Binary Example
var crypto = require('crypto');
var mongoose = require('./');
mongoose.connect('mongodb://localhost/bintest');
var Schema = mongoose.Schema;
var HashSchema = new Schema({
id : String