Skip to content

Instantly share code, notes, and snippets.

Avatar

Boleslav Březovský rebolek

View GitHub Profile
View voronoi.red
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)
]
View mad.red
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
]
View dir
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
Absolutely basic SQL database
View kredenc.red
Red[]
kredenc!: context [
storage: #()
init: does [
self/storage: copy #()
]
View Bibox.md

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}
View 1000cows.red
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 Feb 26, 2018
Experiment with live resizing of draw block
View calendar.red
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 Feb 23, 2018
Live logo
View logo.red
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
View Dispatch
Red[]
dispatcher: func [
"Return dispatcher function that can be extended with DISPATCH"
spec [block!] "Function specification"
][
func spec [
case []
]
]
@rebolek
rebolek / where.red
Last active Feb 16, 2018
Find where function is defined
View where.red
Red[
Title: "Where"
Purpose: "Find where function is defined"
Author: "Boleslav Březovský"
]
where: function [
"Return file where function is defined or NONE, if the definition can't be found"
'name
/in
You can’t perform that action at this time.