Skip to content

Instantly share code, notes, and snippets.

View rebolek's full-sized avatar

Boleslav Březovský rebolek

  • 15:29 (UTC +01:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am rebolek on github.
  • I am rebolek (https://keybase.io/rebolek) on keybase.
  • I have a public key whose fingerprint is EADA FA20 F885 4B16 53F7 1DA3 82BC 760A 4F33 3F8A

To claim this, I am signing this object:

Red[]
dist-to-color: func [dist][
to tuple! reduce [dist * 256 dist * 256 dist * 256]
]
distance: func [start end /local diff][
diff: end - start
absolute square-root diff/x * diff/x + (diff/y * diff/y)
]
@rebolek
rebolek / mad.red
Last active October 3, 2018 13:57
Red[]
tests: [
[
"Normal **bold** preserve ** this *italic* normal **bold *bold italic*** normal"
["Normal " bold "bold" " preserve ** this " italic "italic" " normal " bold "bold " bold italic "bold italic" " normal"]
]
; -- end of tests
]
Red[]
parse-ll: func [dir][
out: copy []
fileinfo!: context [
name: none
size: none
date: none
type: none
]
@rebolek
rebolek / kredenc.red
Created May 25, 2018 13:18
Absolutely basic SQL database
Red[]
kredenc!: context [
storage: #()
init: does [
self/storage: copy #()
]
@rebolek
rebolek / Bibox.md
Last active August 13, 2018 13:40

Bibox API

This document focuses on evaluating Bibox API from the client implementation point of view. The implementation was done using documentation available at GitHub.

HTTP headers

While the documentation sufficiently describes the API calls, it's not enough when implementing the API client from scratch. Bibox server expects specific set of HTTP header, however, these requirements are not specified anywhere and have to be found by trial and error. Without them, HTTP status 500 - Internal server error is returned. When only some of the headers are provided, HTTP status changes to 200 and Bibox error "3000 - 请求参数错误" is returned. Here's the list of required HTTP headers:

origin: {https://www.bibox.com}
Red [
Title: "Kravy"
Needs: 'View
]
do %kravy.red
foreach image kravy/images [
repeat i length? image [
if image/:i = 255.255.255 [image/alpha/:i: 255]
@rebolek
rebolek / calendar.red
Created February 26, 2018 10:18
Experiment with live resizing of draw block
Red[]
month-font: make font! [size: 160]
day-font: make font! [size: 450]
name-font: make font! [size: 120]
center-text: func [
text
font
width
@rebolek
rebolek / logo.red
Last active February 23, 2018 17:03
Live logo
Red[]
frames: [
[
pen 238.172.41
fill-pen 238.172.41 polygon 100x2 86x56 72x42
fill-pen 188.130.45 polygon 100x2 86x56 128x42
pen 212.28.24
fill-pen 212.28.24 polygon 82x72 68x128 36x96 64x54
@rebolek
rebolek / Dispatch
Last active February 18, 2018 06:29
Red[]
dispatcher: func [
"Return dispatcher function that can be extended with DISPATCH"
spec [block!] "Function specification"
][
func spec [
case []
]
]