- (.md) a8m/golang-cheat-sheet
- (site) devhints.io
- (site) quickref.me
- (.pdf) ehmatthes.github.io
- (.md) gto76/python-cheatsheet
- (.md) wilfredinni/python-cheatsheet
- (site) hacker.io
- (site) cs.princeton.edu
- (site) codecademy.com
func User(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
if r.URL.Path == "/user/" {
switch r.Method {
case http.MethodOptions:
case http.MethodGet:
if query["id"]!=nil && len(query)==1 {
// checks "/user/?id=<some_value>", then true
- (site) sitepen.com
- (site) rmonilamir
- (site) 11sigma.com
Basic Idea : The function receives 'path' that will be handled by the server and the 'url' the request was sent to/from.
It will split the 'path' into all the params and parse's and finds those params which has ":" at the beginning.
It will also split the 'url' into all the params that were sent from server.
A loop, loops over all the elements inside the splitted 'path' (here, path_list
), finds the position where ":" is present in a element of path, removes the ":", creates key of with that element, and sets value of the key from the splitted 'url' (here, url_list
) at the same index position.
Makes a map of key-value pairs, returns it, with a boolean of whether the 'path' and 'url' are a match.
// path : the path the `url` will be mathced with
// url : the url the request was sent/received to/from server
func handlePath(path string, url string) (bool, map[string]string) {
- (site) mysqltutorial.org
- (site) devhints.io
- (site) bradtraversy
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
import mysql.connector | |
db = mysql.connector.connect( | |
host="localhost", | |
user="sql_username", | |
password="sql_user_password", | |
database="db_name" # = "USE <database name>;" | |
) | |
cursor = db.cursor() |
- (site) devhints.io
- (site) dockerlabs
- (site) buddy.works
OlderNewer