Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block hash32bot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
hash32bot / gist:14750b9eea739374ca69dc3182ca99a3
Created Mar 8, 2019 — forked from victorlamhk/gist:7019359
Rails 3.1+ force_ssl & HSTS problem
View gist:14750b9eea739374ca69dc3182ca99a3

Rails 3.1 introduced force_ssl. You can add config.force_ssl = true in application.rb.

By enabling force_ssl, Rails send a HSTS (HTTP Strict Transport Security) header which will expired in a year.

So if you enabled force_ssl once, even you change the config value to false later, the browser you used to open you app before will still remember this website (using domain to identify) require to use HTTPS, and redirect you to HTTPS connection automatically. You may use chrome://net-internals/#hsts to check the domain list in Google Chrome.

hash32bot / response.json
Created Dec 25, 2018
Graphql Query response - Graphql Sinatra App -
View response.json
"data": {
"speakers": [
"name": "John",
"twitterHandle": "johnruby",
"bio": "This is John's bio"
"name": "Jacob",
hash32bot / app_5.rb
Created Dec 25, 2018
app.rb changes - Graphql Sinatra -
View app_5.rb
# Changes to file app.rb
# ...
require 'rack/contrib'
class ConferenceApp < Sinatra::Base
# ...
use Rack::PostBodyContentTypeParser
# ...
# ...
post '/graphql' do
result = ConferenceAppSchema.execute(
hash32bot / mutation.graphql
Last active Dec 25, 2018
New speaker mutation - [Post] GraphQL with Sinatra (Ruby) - Part 2- Mutations
View mutation.graphql
mutation AddSpeaker($name:String, $talkTitle:String, $bio:String, $twitterHandle:String) {
createSpeaker(name: $name, talkTitle: $talkTitle, bio: $bio, twitterHandle: $twitterHandle) {
hash32bot / mutation.rb
Last active Dec 25, 2018
Mutation Root - [Post] GraphQL with Sinatra (Ruby) - Part 2- Mutations
View mutation.rb
require 'graphql'
require_relative 'mutations/create_speaker'
class MutationType < GraphQL::Schema::Object
description "The mutation root of this schema"
field :createSpeaker, mutation: Mutations::CreateSpeaker
You can’t perform that action at this time.