The server.rb
file slowly feeds data to the socket, and both clients will yield data as it's available. UneventfulMachine
steals the API of EventMachine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'httparty' | |
class NFLStream | |
attr_accessor :current_scores | |
include HTTParty | |
format :json | |
base_uri "http://www.nfl.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Author | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
... | |
references_and_referenced_in_many :institutes | |
after_save :update_institutes #WORKAROUND | |
... | |
private | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// タンポポの{綿毛}が風にふかれて飛ぶ。 | |
// わたげ | |
// 植物のくきは上の方へのびる{性質}がある。 | |
// せいしつ | |
// 手あらいをよくして伝染<せん>病を{防}ぐ。 | |
// ふせ | |
// 父は{常}に「腹<はら>八分目」を心がけている。 | |
// つね | |
// 母は{雑用}が多くてこまっているようだ。 | |
// ざつよう |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#require 'rack/request' | |
# Rack middleware to decode a `Transfer-Encoding: chunked` HTTP request. | |
# | |
# USAGE NOTE: | |
# | |
# Some HTTP servers (Webrick and Unicorn/Rabinbows/Zbatery) already decode the | |
# chunked stream, but they leave the 'Transfer-Encoding' header and don't bother | |
# to add a 'Content-Length' header, which causes rails ActionDispatch::Request | |
# to not parse the whole request body. |
I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.
These are the steps I went through to set up an SSL cert.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/users/password_controller.rb | |
class Users::PasswordsController < Devise::PasswordsController | |
def resource_params | |
params.require(:user).permit(:email, :password, :password_confirmation) | |
end | |
private :resource_params | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Quickbooks OL-222 error help | |
Quickbooks QBO files are based on the OFX spec. | |
Instead of reading the spec, here are the actual real | |
world rules since Intuit doesn't appear to care about documentation or helping. | |
This is particularly useful if you want to avoid the "OL-222" error when | |
trying to import your own QBO files. | |
<STMTTRN> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/controllers/api_clients_controller_spec.rb | |
RSpec.describe APIClientsController, type: :controller do | |
let(:api_client) { mock_model(APIClient) } | |
context "when HTTP Digest auth credentials are invalid" do | |
before do | |
authenticate_with_http_digest("invalid_login", "invalid_password") do | |
get :index | |
end | |
end |
Example of using a GraphQL service to explore the Twitter API
A great way to explore the Twitter API and returned data, without worrying about authorization or local setup. Just add a query in the explorer and hit run.
The GraphQL Hub website has an interactive GraphiQL service which allows access to Gitub, Twitter, Giphy and other APIs in the browser without authorization.
OlderNewer