Skip to content

Instantly share code, notes, and snippets.

View korzio's full-sized avatar

Alex Korzhikov korzio

View GitHub Profile
@korzio
korzio / filter.go
Last active February 6, 2021 18:08
func (l *Lexer) Tokens() rxgo.Observable {
return l.observable.
Filter(func(i interface{}) bool {
var str = i.(string)
return !isWhitespace(str)
})
// next operator
}
func isWhitespace(ch string) bool {
type interState struct {
Return string // final token value
Save string // running value
}
func isNumber(s String) bool { /* ... */ }
// Tokens observable filter operator ...
Scan(func(_ context.Context, acc interface{}, elem interface{}) (interface{}, error) {
var state interState
state, isToken := acc.(interState)
state.Return = ""
Filter(func(i interface{}) bool {
tok := i.(interState)
return tok.Return != ""
}).
Map(func(_ context.Context, i interface{}) (interface{}, error) {
var tok token.Token
tok.Literal = i.(interState).Return
tok.Type = token.INT
if isOperator(tok.Literal) {
tok.Type = token.TokenType(tok.Literal)
@korzio
korzio / project-ideas01.md
Created October 22, 2020 18:58 — forked from MWins/project-ideas01.md
Back end Projects - list

Project Ideas

Ok. I'm going to list off some ideas for projects. You will have to determine if any particular idea is good enough to include in a portfolio. These aren't creative ideas. They likely already exist. Some are way too advanced while others are simplistic.

I will recommend to post any project you make to github and make a github project page for it. Explain in as much detail as possible how you made it, how it can be improved etc. Document it.

If you pick an advanced idea, setup a development roadmap and follow it. This will show some project management skills.

Another piece of advice for those who are design challenged. Use different front end frameworks and use different themes for those frameworks to provide appealing designs without looking like yet another bootstrap site.

int uv_run(uv_loop_t* loop, uv_run_mode mode) {
int timeout;
int r;
int ran_pending;
r = uv__loop_alive(loop);
if (!r)
uv__update_time(loop);
while (r != 0 && loop->stop_flag == 0) {
next
timeout out
immediate out
fs
next in
immediate in
timeout in
const fs = require('fs')
setTimeout(() => console.log('timeout out'))
setImmediate(() => console.log('immediate out'))
fs.readFile('./events.js', () => {
console.log('fs')
process.nextTick(() => console.log('next in'))
setTimeout(() => console.log('timeout in'))
setImmediate(() => console.log('immediate in'))
const fs = require('fs')
setTimeout(() => console.log('timeout out'))
setImmediate(() => console.log('immediate out'))
fs.readFile('./events.js', () => {
console.log('fs')
process.nextTick(() => console.log('next in'))
setTimeout(() => console.log('timeout in'))
setImmediate(() => console.log('immediate in'))
const timeoutObj = setTimeout(() => {
console.log('timeout')
}, 1500)
const immediateObj = setImmediate(() => {
console.log('immediate')
})
const intervalObj = setInterval(() => {
console.log('interval')
┌───────────────────────────┐
┌─>│ timers │ # setTimeout, setInterval
│ └─────────────┬─────────────┘
│ ┌─────────────┴─────────────┐
│ │ pending callbacks │
│ └─────────────┬─────────────┘
│ ┌─────────────┴─────────────┐
│ │ idle, prepare │ # system
│ └─────────────┬─────────────┘ ┌───────────────┐
│ ┌─────────────┴─────────────┐ │ incoming: │