Skip to content

Instantly share code, notes, and snippets.

View joelongstreet's full-sized avatar

Joe Longstreet joelongstreet

  • Kodable
  • Kansas City, Missouri - United States
View GitHub Profile
var OAuth = require('oauth').OAuth;
var baseURL = 'https://passport.vml.com';
consumer = new OAuth(
baseURL + '/oauth/request_token',
baseURL + '/oauth/access_token',
'w9hJkqLgqRR9mPdrmxyh76qxMrnG3CeD',
'4TAfNxp2JCwCYz4Tn8hP8bwuHe7PWdjK',
'1.0', null, 'HMAC-SHA1'
);
Some test gist right here
@joelongstreet
joelongstreet / ColdPi
Last active August 29, 2015 14:03
A node script for a raspberry pi which collects temperature data and logs it to a .csv
var fs = require('fs');
var path = require('path');
var gpio = require('gpio');
var filePath = path.join(process.cwd(), 'log.csv');
var tempSensor = gpio.export(4, {
direction: 'in',
interval: 5000,
ready: startApp
});
@joelongstreet
joelongstreet / Stepper Motor
Created July 11, 2014 16:55
Short example on how to control a stepper motor
int M1dirpin = 4;
int M1steppin = 5;
void setup()
{
pinMode(M1dirpin,OUTPUT);
pinMode(M1steppin,OUTPUT);
digitalWrite(M1dirpin,LOW);
}
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x08, 0xA1 };
char server[ ]= "api.mongolab.com";
EthernetClient client;
void setup()
int sensorPin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
//getting the voltage reading from the temperature sensor
@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) {