Skip to content

Instantly share code, notes, and snippets.

View joelongstreet's full-sized avatar

Joe Longstreet joelongstreet

View GitHub Profile
@joelongstreet
joelongstreet / FacebookRequest.coffee
Last active October 13, 2015 02:28
Request an access token from facebook and then use it to make a subsequent request.
request = require 'request'
facebook = require 'fb'
get_fb_data = (req, res, next) ->
fb_req = 'https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECCRET&grant_type=client_credentials'
request.get fb_req, (err, res, body) ->
if err then console.log err
@joelongstreet
joelongstreet / RestProof.html
Created February 18, 2013 16:38
A proof showing how to use Amazon S3 as a simple data store for image objects with authors and captions.
<!DOCTYPE html>
<html>
<head>
<title>AS3 Rest Proof</title>
<script src='http://code.jquery.com/jquery-1.9.1.min.js'></script>
<script>
var as3_path = 'http://restproof.s3.amazonaws.com/'
$(function(){
$.ajax({
@joelongstreet
joelongstreet / BeautifulFaces.js
Created February 27, 2013 22:01
Drop this script into your git post-commit hook to take a picture of your face (or butt) every time you make a commit.
#!/usr/bin/env node
var picsPath = process.env['HOME'] + '/.gitshots/';
var imagesnap = require('imagesnap');
var fs = require('fs');
var path = require('path');
var commitPath = picsPath + new Date().getTime();
fs.mkdirParent = function(dirPath, mode, callback) {
fs.mkdir(dirPath, mode, function(error) {
@joelongstreet
joelongstreet / cors.xml
Created March 6, 2013 21:21
Sample AmazonS3 Cors configuration to allow cross domain requests and expose headers.
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
<ExposeHeader>x-amz-meta-author</ExposeHeader>
<ExposeHeader>x-amz-meta-caption</ExposeHeader>
<AllowedHeader>x-amz-*</AllowedHeader>
@joelongstreet
joelongstreet / GistEmbed.txt
Created March 19, 2013 13:20
A sample showing how to create a gist on the vml intranet (Jude).
[embed]https://gist.github.com/joelongstreet/5052198[/embed]
@joelongstreet
joelongstreet / EmbeddingContent.text
Last active December 15, 2015 04:59
A sample showing how to embed various types of content into Jude. This gist is referenced on Jude.
Vimeo [embed]https://vimeo.com/48535034[/embed]
Youtube [embed]http://www.youtube.com/watch?v=LeaAHv4UTI8[/embed]
Google Maps [embed]https://maps.google.com/maps?q=Lake+Como...[/embed]
MeetUp [embed]http://www.meetup.com/nodekc/[/embed]
Pinterest [embed]http://pinterest.com/pin/229894755950834306/[/embed]
Dribble [embed]http://dribbble.com/shots/992837-Point[/embed]
Wikipedia [embed]http://en.wikipedia.org/wiki/Charles_babbage[/embed]
@joelongstreet
joelongstreet / sample.html
Created March 25, 2013 18:55
HTML Entities available on Jude.
<p>The article below shows common html entities and how each will render on the intranet. See the bottom for code used in this post.</p>
<br /><br />
<h2>Heading 1 or 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
<br /><br /><br />
@joelongstreet
joelongstreet / bangproof.html
Last active December 19, 2015 01:39
HTML version of a carnival strong man game.
<!DOCTYPE html>
<html>
<head>
<title>Bang Proof</title>
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1' />
<script src='http://code.jquery.com/jquery-1.10.1.min.js' type='text/javascript'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
<script>
$(function(){
define([
'chaplin',
'models/base/model'
], function(Chaplin, Model) {
'use strict';
var Collection = Chaplin.Collection.extend({
model : Model,
parms : {},
listen : function(){
@joelongstreet
joelongstreet / S3Downloader.js
Created September 11, 2013 15:55
Download all files from an amazon S3 bucket using node.
// Config
var bucketName = 'xxx';
var saveFileDir = 'files';
var creds = {
key : 'xxx',
secret : 'xxx',
bucket : bucketName
};