Skip to content

Instantly share code, notes, and snippets.

View yocontra's full-sized avatar

contra yocontra

View GitHub Profile
# compile
rm -rf dist
mkdir dist
coffee -o dist -c lib/main.coffee lib/defaultClient.coffee lib/Client.coffee lib/Socket.coffee lib/util.coffee
# build
node_modules/.bin/browserbuild -m main -b dist/ node_modules/engine.io-client/lib dist > protosock.js
# minify
node_modules/.bin/uglifyjs -nc --unsafe -mt -o protosock.min.js protosock.js
require 'formula'
class Pdf2htmlex < Formula
homepage 'http://coolwanglu.github.com/pdf2htmlEX/'
url 'https://github.com/coolwanglu/pdf2htmlEX/tarball/master'
head 'https://github.com/coolwanglu/pdf2htmlEX.git'
depends_on 'cmake' => :build
depends_on 'fontforge'
@yocontra
yocontra / pdf2htmlEX.rb
Created October 9, 2012 17:37
homebrew install for master
require 'formula'
class Pdf2htmlex < Formula
homepage 'http://coolwanglu.github.com/pdf2htmlEX/'
url 'https://github.com/coolwanglu/pdf2htmlEX/tarball/master'
version '0.3.2'
head 'https://github.com/coolwanglu/pdf2htmlEX.git'
depends_on 'cmake' => :build
depends_on 'fontforge'
@yocontra
yocontra / prox
Last active December 10, 2015 19:08
prox
sudo sh -c 'echo "proxyserver=\"chisproxy.amers.ibechtel.com\"
proxyport=\"8080\"
git config --global url.https://github.com/.insteadOf git://github.com/
function proxy(){
echo -n \"Bechtel Username: \"
read -e username
echo -n \"Bechtel Password: \"
read -es password
export http_proxy=\"http://\$username:\$password@\$proxyserver:\$proxyport\"
rivets.configure({
adapter: {
subscribe: function(obj, keypath, callback) {
if (obj instanceof Backbone.Collection) {
obj.on('add remove reset', function () {
callback(obj[keypath])
});
} else {
obj.on('change:' + keypath, function (m, v) { callback(v) });
};
@yocontra
yocontra / example.js
Last active December 12, 2015 12:39
Backbone layout manager
FooterV = SomeViewInstance;
MainV = SomeViewInstace;
MyLayout = Backbone.Layout.extend({
template: function(){
// this can be any js function that returns html or a jquery el
return "<div id='sidebar'/><div id='main'/><div id='footer'/>";
},
// Define friendly names for regions
@yocontra
yocontra / server.js
Last active December 14, 2015 05:29
Streaming mongodb APIs
var mongoose = require('mongoose');
var http = require('http');
var JSONStream = require('JSONStream');
var PersonSchema = new mongoose.Schema({
name: String,
num: Number
});
mongoose.connect("mongodb://localhost:27017");
@yocontra
yocontra / djb2.jl
Created February 26, 2013 15:48
djb2 hashing in julia
function djb2(s)
r = 5381
for i in s
c = int(i)
r = r + (r << 5) + c
end
return r
end
println(djb2("test"))
[][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]][([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]]+([][[]]+[])[+[[+!+[]]]]+(![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[+!+[]]]]+([][[]]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[
@yocontra
yocontra / faces.js
Created March 27, 2013 06:38
faces json output script
JSON.stringify($("img").map(function () {
var e = $(this);
return {
url: e.parent().attr('href'),
image: e.attr('src')
};
}).get());