Skip to content

Instantly share code, notes, and snippets.

Linking CXX shared library ../../lib/libopencv_highgui.dylib
brew: superenv removed: -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-deprecated-declarations
Undefined symbols for architecture x86_64:
"_faacEncClose", referenced from:
_Faac_encode_close in libavcodec.a(libfaac.o)
"_faacEncEncode", referenced from:
_Faac_encode_frame in libavcodec.a(libfaac.o)
"_faacEncGetCurrentConfiguration", referenced from:
_Faac_encode_init in libavcodec.a(libfaac.o)
"_faacEncGetDecoderSpecificInfo", referenced from:
@craigyk
craigyk / gist:3831786
Created October 4, 2012 06:31
connect-session implementation
crypto = require 'crypto'
connectionSecure = (req,trust_proxy=true) ->
secure_proxy = ( req.headers['x-forwarded-proto'] or '' ).toLowerCase() == 'https'
req.connection.encrypted or ( trust_proxy and secure_proxy )
createID = (len) -> crypto.randomBytes(Math.ceil(len*3/4)).toString('base64').slice(0,len)
# not implemented yet
signId = (unsignedid,secret) -> unsignedid
@craigyk
craigyk / obs.coffee
Created February 14, 2012 19:21
JS computed and observable variables
frames = []
addFrame = (frame) -> frames.push frame || []
addToStack = (obs) -> if frames.length > 0 then frames[frames.length-1].push obs
mergeFrame = (obs) -> if frames.length > 0 then frames[frames.length-1] = frames[frames.length-1].concat obs
popFrame = ->
popped = unique frames.pop()
mergeFrame popped
return popped
unique = (frame) ->
@craigyk
craigyk / benchmark.coffee
Created February 14, 2012 19:21
JS computed and observable variables
runs = 0
count = 10000
stop = false
t_make = 0
t_update = 0
t_verify1 = 0
t_verify2 = 0
self.stop = -> stop = true
self.startmy = ->
t_make = 0
@craigyk
craigyk / upload.coffee
Created February 4, 2012 07:31
http ServerRequest data loss?
app.put '/uploads/:fileid', (request,response) ->
getCachePath (path) -> #... does a bunch of prep
stream = fs.createWriteStream path,
bufferSize: 1024*1024*4
encoding: 'binary'
start: start
flags: if start != 0 then 'r+' else 'w'
stream.on 'close', ->
@craigyk
craigyk / upload.coffee
Created February 1, 2012 06:46
an http handler test case for when the server kills an XHR upload
http = require 'http'
server = http.createServer (request,response) ->
console.log request
switch request.method
when 'OPTIONS'
response.setHeader 'Access-Control-Allow-Origin', '*'
response.setHeader 'Access-Control-Allow-Methods', 'PUT'
response.setHeader 'Access-Control-Allow-Headers', 'Content-Range'
response.setHeader 'Access-Control-Max-Age', '0'
@craigyk
craigyk / code.coffee
Created January 31, 2012 23:32
Cancel request transfer, send response
express = require 'express'
app = express.createServer()
app.put '/uploads/:fileid', (request,response) ->
isvalid = false # ...code to determine validity of file being sent in the ServerRequest
if isvalid
# continue handling the upload
else
# the following two options are both unreliable