This represents a proof of concept, minimal web stack. I used http://nicolasmerouze.com/build-web-framework-golang/ series of articles as a starting point and the goal was to keep the stack as minimal as possible while still being useful for practical purposes. And of course, use the standard library as much as possible and only integrate components compatible with it.
| type ApacheLogRecord struct { | |
| http.ResponseWriter | |
| ip string | |
| time time.Time | |
| method, uri, protocol string | |
| status int | |
| responseBytes int64 | |
| elapsedTime time.Duration | |
| } |
| package main | |
| import ( | |
| "database/sql" | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "time" |
A console to recreate the famous "Harder, Better, Faster, Stronger" by Daft Punk. Use your keyboard ! not the mouse (hey, it's a console). Use the other keys to get different sounds (Normal, High, Low). You can do it !
Forked from Malik Dellidj's Pen #DaftPunKonsole.
A Pen by Captain Anonymous on CodePen.
| connection = Faraday::Connection.new('http://example.com') do |builder| | |
| builder.request :url_encoded # for POST/PUT params | |
| builder.adapter :net_http | |
| end | |
| # same as above, short form: | |
| connection = Faraday.new 'http://example.com' | |
| # GET | |
| connection.get '/posts' |
It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:
>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
| /* bling.js */ | |
| window.$ = document.querySelectorAll.bind(document) | |
| Node.prototype.on = window.on = function (name, fn) { | |
| this.addEventListener(name, fn) | |
| } | |
| NodeList.prototype.__proto__ = Array.prototype |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
- Stores data elements based on an sequential, most commonly 0 based, index.
- Based on tuples from set theory.
| using Newtonsoft.Json; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Configuration; | |
| using System.IdentityModel.Tokens; | |
| using System.Linq; | |
| using System.Net.Http; | |
| using System.Security.Cryptography.X509Certificates; | |
| using System.Text; |
