Skip to content

Instantly share code, notes, and snippets.

View skanev's full-sized avatar

Stefan Kanev skanev

View GitHub Profile
@skanev
skanev / chronicle.md
Last active October 31, 2024 20:01
Twitch Streaming Plan

Chronicle

I’m building an app on Twitch. Here’s an outline of what’s going on. You watch here.

Motivation

I’d like make a non-trivial web application that is both (1) useful to me on a daily basis and (2) I can use as a test-bed for experimentation with different tech. Functionality-wise, I imagine it will end up being a smörgåsbord of things I need (calories/exercise tracking, expense tracking, simple notes, todo lists, daily habits, what have you). Tech-wise, it will start as a classic Rails app, but once this is done, I might do things like:

  • Create a GraphQL API and build a React SPA front end
  • Build separate mobile clients with iOS, Android, React Native, Flutter, etc.
@skanev
skanev / baba.tsx
Created July 17, 2024 15:05
RxJS Demo
import {useEffect, useState} from 'react'
import {
combineLatest,
debounceTime,
distinctUntilChanged,
filter,
from,
fromEvent,
map,
Observable,
@skanev
skanev / dev-bg.ts
Created June 21, 2023 17:39
Dev BG example code
console.log('baba')
// 1. Literal types
{
let meta: 'foo' = 'foo'
meta = 'foo'
// @ts-expect-error
meta = 'bar'
@skanev
skanev / 00-ADVENT-OF-CODE-2022-RUBY.md
Last active February 21, 2024 13:07
Advent of Code 2022 in Ruby (sort of)

Advent of Code 2022 solutions in Perl Ruby

Just for kicks, I'm trying to solve them with semi-golfed Ruby. That is:

  • As short as possible, but
  • Have some whitespace to make them somewhat readable
  • Avoid single-letter identifiers to keep them somewhat readable
  • Don't make them too short when they are short enough

Each solution parses the input file and outputs the answer.

#!/usr/bin/env zsh
typeset -gA jump_locations
jump_locations=(
zeitwerk ~/prj/zeitwerk
rails ~/prj/rails-dev-box/rails
tmp ~/tmp
)
@skanev
skanev / Apollo+Rx.swift
Last active April 30, 2024 15:07
Homegrown fetchMore in Apollo iOS
import Foundation
import RxSwift
import RxRelay
import Apollo
// MARK: - Apollo Support
enum ApolloError: Error {
case genericError(String)
case graphqlErrors([GraphQLError])
@skanev
skanev / GRAPHQL.markdown
Last active April 27, 2017 19:38
On GraphQL

I like GraphQL for the regular reasons. It feels to me that it delivers on its promise, althought it's not simple or straightforward to start using it (but neither is SQL itself).

I'll approach this from two perspectives:

Using a GraphQL API as a client

I had the experience on this side when doing a small internal app ontop of the GitHub GraphQL API. The previous version was using the REST API and it had a

@skanev
skanev / less-quickshell.patch
Last active March 26, 2016 14:40
A patch for homebrew less to add a not very useful option
diff --git a/command.c b/command.c
index c31fa81..11d7483 100644
--- a/command.c
+++ b/command.c
@@ -273,10 +273,13 @@ exec_mca()
if (secure)
break;
- if (shellcmd == NULL)
+ if (shellcmd == NULL) {
@skanev
skanev / MATH_JOKE.markdown
Created January 29, 2015 14:08
Best. Math Joke. Ever.

When the Ark eventually lands after the Flood, Noah releases all the animals and makes a proclamation: "Go forth and multiply".

Several months later, Noah is delighted to see that all the creatures are breeding, except a pair of snakes, who remain childless. Noah asks: "What's the problem?" The snakes have a simple request of Noah: "Please cut down some trees and let us live there."

Noah obliges, leaves them alone for a few weeks and then returns. Sure enough, there are lot of baby snakes. Noah asks why it was important to cut down the trees, and the snakes reply: "We're adders, and we need logs to multiply."

@skanev
skanev / functional_programming.rb
Last active August 29, 2015 14:14
My "slides" from WCEU 2014
# encoding: utf-8
def annotate(string, code = '4')
string.gsub(/@(.*?)@/, "\e[#{code}m\\1\e[0m")
end
def colorize(string)
string.gsub(/#(.*?)#/, "\e[\\1m").gsub(/##/, "\e[0m")
end