Skip to content

Instantly share code, notes, and snippets.

View gonzalo-bulnes's full-sized avatar

Gonzalo Bulnes Guilpain gonzalo-bulnes

View GitHub Profile
@vmarmol
vmarmol / client.go
Created February 9, 2015 23:21
Simple Go-based HTTP streaming via HTTP and websockets.
package main
import (
"encoding/json"
"flag"
"io"
"net/http"
"github.com/golang/glog"
"golang.org/x/net/websocket"

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@alex-sysoev
alex-sysoev / vcr_spec.md
Last active August 29, 2015 14:05
Test Web Services with VCR

Testing Web Services with RSpec & VCR

Often our application interacts with different web services, in order to test it we need to do some preparations to be able to stub those requests and then if they take a lot of time to proceed - to replay the records of it without repeating real requests.

Installation

To install VCR we need to add two gems to the test group, gem webmock will be installed as a dependancy and will handle all the external requests, there are

@alex-sysoev
alex-sysoev / spree_specs.md
Last active October 12, 2017 19:51
Spree application specs based on native factories.

Testing Spree with RSpec

Spree has a lot of native factories, that could help you to test your spree-based application, creating "testing infrastructure". The first thing you should do (if it is not done yet) is to load Spree factories in your app.

#spec_helper.rb
  require 'spree/testing_support/factories'

  #As well you might want to add more spree testing stuff such as preferences:
@bryfry
bryfry / gzip.go
Last active July 25, 2024 03:38
Idiomatic golang net/http gzip transparent compression (works with Alice)
package main
import (
"compress/gzip"
"io"
"net/http"
"strings"
)
// Gzip Compression
@dnlserrano
dnlserrano / api_controller.rb
Last active January 19, 2021 09:56
Custom Authentication Controllers
class ApiController < ApplicationController
# define which model will act as token authenticatable
acts_as_token_authentication_handler_for Login
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session
respond_to :json
skip_before_filter :verify_authenticity_token, if: :json_request?
@felipecabargas
felipecabargas / mclovin_controller.rb
Created February 6, 2014 20:33
Simple HTTP Basic Auth snippet for RailsControllers
before_filter :authenticate
protected
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == "foo" && password == "bar"
end
end
@felipecabargas
felipecabargas / spec_helper.rb
Last active August 29, 2015 13:55
Spree SpecHelper with ControllerRequests, Devise & Paperclip
# Run Coverage report
require 'simplecov'
SimpleCov.start do
add_filter 'spec/dummy'
add_group 'Controllers', 'app/controllers'
add_group 'Helpers', 'app/helpers'
add_group 'Mailers', 'app/mailers'
add_group 'Models', 'app/models'
add_group 'Views', 'app/views'
add_group 'Libraries', 'lib'
@pdaire
pdaire / fci_job.json
Last active December 16, 2015 19:10
Un nuevo miembro para el devteam. Te esperamos
{
"Ofrecemos":
[
"Trabajo que importa, con posibilidades de cambiar el mundo.",
"Satisfacción profesional y personal",
"Espacio para aprender, investigar e innovar",
"Ser miembro de un equipo amistoso, respetuoso e innovador",
"Ser parte de una organización multidisciplanaria con redes en varios países",
"Mesa de ping-pong",
"café café"