Skip to content

Instantly share code, notes, and snippets.

View jrabary's full-sized avatar

Jaonary Rabarisoa jrabary

View GitHub Profile
Factory.define :item do |f|
include ActionDispatch::TestProcess
f.name "Macbook Pro 15"
f.price_in_dollars 1500
f.photo fixture_file_upload('/files/avatar.jpg', 'image/jpg')
end

Recently, we've been working on extracting Ember conventions from applications we're working on into the framework. Our goal is to make it clearer how the parts of an Ember application work together, and how to organize and bootstrap your objects.

Routing

Routing is an important part of web applications. It allows your users to share the URL they see in their browser, and have the same things appear when their friends click on the link.

The Ember.js ecosystem has several great solutions for routing. But, since it is such an important part of most web applications, we've decided to build it right into the framework.

If you have already modeled your application state using Ember.StateManager, there are a few changes you'll need to make to enable routing. Once you've made those changes, you'll notice the browser's address bar spring to life as you start using your app—just by moving between states, Ember.js will update the URL automatically.

@jrabary
jrabary / client.html
Created June 22, 2012 11:48 — forked from matiasfha/client.html
nodejs + thrift +socket.io for image streaming
<script src="jquery-1.6.1.min.js"></script>
<script src="socket.io/socket.io.js"></script>
<script>
var socket = new io.Socket(null,{port:8080});
socket.connect();
socket.on('message',function(obj){
switch(obj.tipo){
case 'imagen':
img = document.getElementById('stream');
img.src="";
@jrabary
jrabary / Gitlab.md
Created December 3, 2012 16:24
Configuracion de gitlab

Platform requirements:

The project is designed for the Linux operating system.

It may work on FreeBSD and Mac OS, but we don't test our application for these systems and can't guarantee stability and full functionality.

We officially support (recent versions of) these Linux distributions:

  • Ubuntu Linux
  • Debian/GNU Linux
#
# blob : Object from MongoDB
#
# blob.body: Buffer
# blob.size: length of buffer, substitute for blob.body.length
# blob.type: MIME (Eg. audio/x-wav)
#
# req : Object from http
# res : Object from http
# _ : Object from underscore
# First attempting to use Capybara directly, you will ran into issues when trying to set HTTP header.
# Using Basic HTTP Authentication requires that we needed to set the header.
# Also we need to set the Content-Type and Accept headers to ensure that Rails handles the input and output correctly.
# When using Rack, Capybara delegates request and response handling down to Rack::Test.
# So I used Rack::Test directly in my step definitions, and it works.
# Rack::Test has a module called Rack::Test::Methods that can be mixed into a class to provide it
# with methods for get, post, put, delete as well as last_request, last_response, header and more.
# I mixed Rack::Test::Methods into the Cucumber world at the top of our API steps file like so:
##############################
package json
import reactivemongo.bson._
import reactivemongo.bson.handlers.DefaultBSONHandlers._
import play.api.libs.json._
import play.api.libs.json.Json._
import play.api.libs.json.util._
import play.api.libs.json.Writes._
import play.api.libs.functional.syntax._
import play.api.mvc._
trait CorsSupport { self: Controller =>
def CorsAction(cb: => Result): Action[AnyContent] =
Action(cb.withHeaders(actionCorsHeaders: _*))
def CorsAction(cb: Request[AnyContent] => Result): Action[AnyContent] =
Action { request =>
cb(request).withHeaders(actionCorsHeaders: _*)
import numpy as np
import theano
import theano.tensor as T
from theano import ifelse
from .. import init
from .. import nonlinearities
from .base import Layer
@jrabary
jrabary / DDPG.py
Created July 19, 2017 20:01 — forked from kkweon/DDPG.py
Continuous control with deep reinforcement learning (DDPG) https://arxiv.org/abs/1509.02971
"""
Deep Deterministic Policy Gradients (DDPG)
https://arxiv.org/pdf/1509.02971.pdf
TODO: Batch Normalization Bug
"""
import argparse
import random
import numpy as np
import gym