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
var buf bytes.Buffer | |
gif.Encode(&buf, image.Rect(0, 0, 1, 1), nil) |
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 ( | |
"bytes" | |
"image" | |
"image/color" | |
"image/draw" | |
"image/jpeg" | |
... | |
) | |
buf := new(bytes.Buffer) |
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 ( | |
"bytes" | |
"image" | |
"image/gif" | |
"net/http" | |
... | |
) | |
var buf bytes.Buffer | |
gif.Encode(&buf, image.Rect(0, 0, 16, 16), nil) |
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
func faviconHandler(w http.ResponseWriter, r *http.Request) { | |
http.ServeFile(w, r, "relative/path/to/favicon.ico") | |
} | |
... | |
func main() { | |
http.HandleFunc("/favicon.ico", faviconHandler) | |
} |
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 ( | |
"testing" | |
) | |
type box struct { | |
data *byte | |
} |
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 ( | |
"math/rand" | |
"testing" | |
"time" | |
) | |
// slice_and_heap_allocation_test.go |
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
#!/bin/sh | |
# USAGE "local" (change manualy value in <USER>, <SERVER_HOST>, <SERVER_PORT> and <REPO_DIR>): | |
# | |
# cd ~/wks/src/github.com/<USER>/project | |
# git remote add prod ssh://root@<SERVER_HOST>:<SERVER_PORT><REPO_DIR> | |
# CONFIG |
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
call plug#begin('~/.vim/plugged') | |
Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} | |
" color schema | |
Plug 'morhetz/gruvbox' | |
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } | |
Plug 'jiangmiao/auto-pairs' | |
Plug 'airblade/vim-gitgutter' |
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
#!/bin/bash | |
# How fast is PHP-8 going to be? | |
# https://levelup.gitconnected.com/how-fast-is-php-8-going-to-be-f7fdc111cd6 | |
mkdir ~/wks/src/roman.dev/how_fast_php8 | |
cd ~/wks/src/roman.dev/how_fast_php8 | |
wget https://gist.githubusercontent.com/romanitalian/c39b7e3182c82f518f0bd74e531f39d1/raw/3e8235f998aaf9f19b671fda75de80393756e33e/bubble.php |
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
<?php | |
function bubble_sort($array) | |
{ | |
$start = microtime(true); | |
do | |
{ | |
$sw = false; | |
for($i = 0, $size = count($array) - 1; $i < $size; $i++) | |
{ | |
if( $array[$i] > $array[$i + 1] ) |