Skip to content

Instantly share code, notes, and snippets.

View theleoborges's full-sized avatar

Leonardo Borges theleoborges

View GitHub Profile
@theleoborges
theleoborges / robot.js
Created December 3, 2012 03:28
MassiveDestructionMachine
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.rotateCannon(90);
@theleoborges
theleoborges / DepthJS setup
Created April 29, 2012 11:41 — forked from gabriel/DepthJS setup
xcode jpeg tiff dylib fix
# Install ZeroMQ
sudo brew install zmq
easy_install pyzmq
[0] http://www.zeromq.org/bindings:python
# Install OpenCV
sudo brew install opencv
# Install libusb
@theleoborges
theleoborges / gist:1686173
Created January 27, 2012 00:42 — forked from boundvariable/gist:1685985
Chapter 5 example
//I guess I'd go with straight functions into a module you could mixin or use directly OR objects...
//On the first option, something like this:
var app = app || {};
app.server = app.server || {};
app.server.http = function() {...};
app.server.get = function() {...};
app.server.post = function() {...};
//And for the second option:
@theleoborges
theleoborges / gist:996758
Created May 28, 2011 09:58
A few useful git commands
#undo last commit
git reset HEAD^
#show files in a given commit
git show --pretty="format:" --name-only rev_number
#remove untracked files and directories
git clean -f -d
#track remote branch
public enum Clazzes {
param1 ("java.lang.String"),
param2 ("java.util.ArrayList");
private final String clazz;
Clazzes(String clazz) {
this.clazz = clazz;
}
public Object get() throws Exception {
return Class.forName(clazz).newInstance();
@theleoborges
theleoborges / gist:913382
Created April 11, 2011 11:29
Ruby 1.9 SSL
The fix for this..
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
Seems to be setting this config:
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
The question though is, why it fixes it? Is it actually the right way to fix it?
#ruby
> a = [0]
> i = 0; for i in 0...(a.size) do; puts "in the loop"; end
> puts i
Produces:
# in the loop
# 0
@theleoborges
theleoborges / gist:791034
Created January 22, 2011 10:33
hacking-rubys-syntax#5
pvt.rb:10:in `': private method `say_hello' called for # (NoMethodError)
@theleoborges
theleoborges / test.rb
Created January 22, 2011 10:32
hacking-rubys-syntax#5
class Test
def_p say_hello
puts "I'm a private method"
end
end
Test.new.say_hello
@theleoborges
theleoborges / gist:791031
Created January 22, 2011 10:28
hacking-rubys-syntax#4
$ ./configure
$ make