Skip to content

Instantly share code, notes, and snippets.

View rebolek's full-sized avatar

Boleslav Březovský rebolek

  • 10:00 (UTC +02:00)
View GitHub Profile
Red[]
count-lines: func [
filename
/local
file count ws
][
ws: charset " ^-"
file: read/lines filename
count: 0
@rebolek
rebolek / test
Created February 13, 2018 08:13
```
mal-scalar: [
any whitespace [
p: (probe p)
"nil" keep ('nil)
| "true" keep ('true)
| "false" keep ('false)
| tmp: mal-number keep (to-integer tmp)
| tmp: mal-string keep (tmp)
| tmp: mal-keyword keep (to-get-word tmp)
@rebolek
rebolek / where.red
Last active February 16, 2018 14:58
Find where function is defined
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
@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 []
]
]
@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 / 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
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 / 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}
@rebolek
rebolek / kredenc.red
Created May 25, 2018 13:18
Absolutely basic SQL database
Red[]
kredenc!: context [
storage: #()
init: does [
self/storage: copy #()
]
Red[]
parse-ll: func [dir][
out: copy []
fileinfo!: context [
name: none
size: none
date: none
type: none
]