Skip to content

Instantly share code, notes, and snippets.

View cassiozen's full-sized avatar
:atom:

Cassio Zen cassiozen

:atom:
View GitHub Profile
#!/usr/bin/env ruby
require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => ARGV[0] || 8000,
:DocumentRoot => Dir::pwd
)
## mount subdirectories
#!/usr/bin/env ruby
require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => ARGV[0] || 8000,
:DocumentRoot => Dir::pwd
)
## mount subdirectories
@cassiozen
cassiozen / hack.sh
Created April 3, 2012 13:47 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
/* Based on gmail-refreshest by @roycifer */
/* @match mail.google.com */
body, td, input, textarea, select {font-family:"Helvetica Neue",helvetica,arial,sans-serif;}
.gbeti#gb .gbqldr, .gbet#gbqlw .gbqldr, .gbesi#gb .gbqldr, .gbes#gbqlw .gbqldr{max-height:35px;margin-top:3px;}
.w-asZ .L3:hover, .w-asZ .L3:active, .gbqfb:hover, .gbqfb:active{background:#333;border-color:#000;}
.T-I-ax7, .T-I-KE, .ej .Bq{font-family:"Helvetica Neue",helvetica,arial,sans-serif;font-weight:normal;cursor:pointer}
.T-I-ax7:hover, .T-I-ax7:active, .T-I-KE:hover, .T-I-KE:active, .ej .Bq:hover, .ej .Bq:active{background:#e6e6e6 !important;box-shadow:0 0 2px #eee;}
.T-I .T-I-J3{margin-top:-5px;}
.Cq .T-I{margin-right:4px;}
@cassiozen
cassiozen / NeuralNetwork.lua
Created July 17, 2014 20:05
Lua Neural Network
ACTIVATION_RESPONSE = 1
NeuralNetwork = {
transfer = function( x) return 1 / (1 + math.exp(-x / ACTIVATION_RESPONSE)) end --This is the Transfer function (in this case a sigmoid)
}
var Dispatcher = require('flux').Dispatcher;
/*
* Do not create helper methods such as "handleViewAction" unless you have a use case in your app
var AppDispatcher = new Dispatcher();
AppDispatcher.handleViewAction = function(action) {
this.dispatch({
source: 'VIEW_ACTION',
action: action
});
create: function(text) {
// Instead of using the helper
// AppDispatcher.handleViewAction(...)
// Dispatch directly
AppDispatcher.dispatch({
actionType: TodoConstants.TODO_CREATE,
text: text
});
}
var TodoStore = assign({}, EventEmitter.prototype, {
/*
* These aren't really necessary:
*
addChangeListener: function(callback) {
this.on(CHANGE_EVENT, callback);
},
removeChangeListener: function(callback) {
this.removeListener(CHANGE_EVENT, callback);
}
componentDidMount: function() {
// Instead of TodoStore.addChangeListener(this._onChange);
TodoStore.addListener(StoreConstants.CHANGE, this._onChange);
},
componentWillUnmount: function() {
// Instead of TodoStore.removeChangeListener(this._onChange);
TodoStore.removeListener(StoreConstants.CHANGE,this._onChange);
},
var contacts = {};
var handleAddContact = (action) => {
contacts.assign(contacts, action.contact);
ContactsStore.emitChange();
}
var handleRemoveContact = (action) => {
var updatedContacts = state.contacts.filter((contact) => {
return contact.id !== action.contact.id;