Skip to content

Instantly share code, notes, and snippets.

View joemccann's full-sized avatar
💭
Thinking

Joe McCann joemccann

💭
Thinking
View GitHub Profile
@joemccann
joemccann / for-zahn.php
Created March 18, 2013 14:04
For Dustin Zahn
<?php
$dirname = "./"; // Change this to your directory; this is the current directory
$dir = opendir($dirname);
while(false != ($file = readdir($dir))){
if(($file != ".") and ($file != "..")){
echo($file);
echo("\n");
@joemccann
joemccann / express-strap.md
Last active June 21, 2020 06:39
Boilerplate for creating an Express app using Boostrap
app="YOUR_APP_NAME"
mkdir $app
cd $app
git init
touch README.MD
echo "$app \n=\nWill add more info soon." >> README.MD 
sudo npm install -g express less uglify-js 
express --css less -e
mkdir vendor
@joemccann
joemccann / index.js
Created February 18, 2013 04:12
voxel.js game
var createGame = require('voxel-engine')
function sphereWorld(x, y, z) {
// return the index of the material you want to show up
// 0 is air
if (x*x + y*y + z*z > 15*15) return 0
return 3
}
var game = createGame({
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error: There was an error while attempting to deploy the app
error:
error: package.json error: can't find starting script: node app
error: Package.json start script declared but not found
error:
error: This type of error is usually a user error.
error: Error output from Haibu:
error:
@joemccann
joemccann / ocr.js
Created January 20, 2013 00:50
Optical Character Recognition with node.js and Tesseract. Check your console for the results...
var ncr = require('nodecr')
, request = require('request')
, fs = require('fs')
, test_img = 'https://www.google.com/images/srpr/logo3w.png' // Change this to your image
// Create image name from end of URL.
// Note this will fail in loads of cases.
var imgName = test_img.split('/').pop()
// Process the image and read the text from it using Tesseract
info: Creating snapshot 0.3.1-9
info Uploading: [=============================] 100%
info: Updating app Dillinger
info: Activating snapshot 0.3.1-9 for Dillinger
info: Starting app Dillinger
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error:
error: There was an error while attempting to start the app
error: Error spawning drone
@joemccann
joemccann / log.sh
Created October 5, 2012 13:10
jitsu deploy error
λ ~work/dillinger/ master* jitsu apps start Dillinger
info: Welcome to Nodejitsu joemccann
info: It worked if it ends with Nodejitsu ok
info: Executing command apps start Dillinger
info: Starting app Dillinger
error: Error running command apps start Dillinger
error: Nodejitsu Error (500): Internal Server Error
warn: Error returned from Nodejitsu
error: Error: socket hang up
error: at createHangUpError (http.js:1263:15)
@joemccann
joemccann / pipe-to-twitter.js
Created August 29, 2012 14:11
node twitter oauth hell.
// This is in the same file in my node app, but split so you can see what is being used where
pipeToTwitter: function(echo, req, res){
// TODO: Not sure if this check goes here or in pipePhotoToTwiter() in twitter.js plugin
if(!req.session.twitter.oauth){
res.type('text/plain')
return res.status(403).send("You are not authenticated with Facebook.")
}
// TODO: EVENTUALLY WE WILL NEED TO CHECK THE
@joemccann
joemccann / fuckingoauth.js
Created August 28, 2012 17:11
fucking_oauth.js
// TODO: Not sure if this check goes here or in pipePhotoToTwiter() in twitter.js plugin
if(!req.session.twitter.oauth){
res.type('text/plain')
return res.status(403).send("You are not authenticated with Facebook.")
}
// TODO: EVENTUALLY WE WILL NEED TO CHECK THE
// https://api.twitter.com/1/help/configuration.json
// RESPONSE THAT CONTAINS SHORT URL CHARS AND MAX MEDIA UPLOADS
// SEE https://dev.twitter.com/docs/api/1/get/help/configuration
@joemccann
joemccann / jitsu.sh
Created August 26, 2012 06:45
jitsu deploy error
λ ~work/photopipe/ master* jitsu deploy
info: Welcome to Nodejitsu joemccann
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing your application dependencies in node app.js
warn: Local version appears to be old
warn: Your package.json version will be incremented for you automatically
warn: About to write /Users/joemccann/Documents/workspace/photopipe/package.json
warn: Using '*' as version for dependencies may eventually cause issues.
warn: Please use specific versions for dependencies to avoid future problems.