This file contains hidden or 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 'thread' | |
| require 'json' | |
| require 'fiber' | |
| require 'eventmachine' | |
| require 'em-http-request' | |
| module Async | |
| class Request | |
| attr_accessor :url, :body |
This file contains hidden or 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
| package main | |
| import ( | |
| "net/http" | |
| "fmt" | |
| ) | |
| func process(w http.ResponseWriter, r *http.Request) { | |
| r.ParseForm() | |
| fmt.Fprintln(w, r.Form) |
This file contains hidden or 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
| package main | |
| import ( | |
| "net/http" | |
| "io/ioutil" | |
| "fmt" | |
| ) | |
| func process_multipart_form(w http.ResponseWriter, r *http.Request) { | |
| r.ParseMultipartForm(1024) |
This file contains hidden or 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
| package main | |
| import ( | |
| "net/http" | |
| "fmt" | |
| ) | |
| func writeExample(w http.ResponseWriter, r *http.Request) { | |
| str := `<html> | |
| <head><title>hello</title></head> |
This file contains hidden or 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
| package main | |
| import ( | |
| "net/http" | |
| "fmt" | |
| "encoding/json" | |
| ) | |
| func writeExample(w http.ResponseWriter, r *http.Request) { | |
| str := `<html> |
This file contains hidden or 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
| package main | |
| import ( | |
| "net/http" | |
| "encoding/base64" | |
| "fmt" | |
| "time" | |
| ) | |
| func setMessage(w http.ResponseWriter, r *http.Request) { |
This file contains hidden or 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
| package main | |
| import ( | |
| "net/http" | |
| "html/template" | |
| ) | |
| func process(w http.ResponseWriter, r *http.Request) { | |
| t, _ := template.ParseFiles("tmpl.html") | |
| t.Execute(w, "Hello World!") |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <style> | |
| .content { | |
| width: 80%; | |
| } | |
| .share ul{ | |
| list-style: none |
This file contains hidden or 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
| Pry.config.exception_handler = proc do |output, exception, _| | |
| if UserError === exception && SyntaxError === exception | |
| output.puts "SyntaxError: #{exception.message.sub(/.*syntax error, */m, '')} | |
| else | |
| output.puts "#{exception.class}: #{exception.message}" | |
| output.puts "from #{exception.backtrace}" | |
| end | |
| end |
This file contains hidden or 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 Demo | |
| def initialize(n) | |
| @secret = n | |
| end | |
| def get_binding | |
| return binding() | |
| end | |
| end |