Skip to content

Instantly share code, notes, and snippets.

const openingHoursDiff = (workHours, date) => {
let [currentHour, currentMinute] = [date.getHours(), date.getMinutes()]
let current = currentHour * 100 + currentMinute
let {open, close} = workHours
let [openHour, openMinute] = [Math.floor(open / 100), open % 100]
let [closeHour, closeMinute] = [Math.floor(close / 100), close % 100]
let openMidnight = openHour == 0 && currentHour == 23
@dosbol
dosbol / http_streaming.md
Created May 30, 2023 05:14 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@dosbol
dosbol / clojure-learning-list.md
Created December 11, 2022 11:44 — forked from ssrihari/clojure-learning-list.md
An opinionated list of excellent Clojure learning materials

An opinionated list of excellent Clojure learning materials

These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.

  • 🔴 Mandatory (for both beginners and intermediates)
  • 🟩 For beginners
  • 🟨 For intermediates

Table of contents

  1. Getting into the language
(ns main
(:require
[clojure.string :as str]
[clojure.math.combinatorics :as combo]))
(comment
;; day 1
;;
[{:id :question1
:text "Question 1"
:options ["Option 1" "Option 2" "Option 3"]
:style :inline-clickable}
{:id :question2
:text "Question 2"
:options ["Option 1" "Option 2"]
:style :dropdown
:depends-on {:id :question1 :values #{"Option 1"}}}]
[{:id :experience-level
:text "How was your experience with us today?"
:options ["Very good" "Good" "Neutral" "Bad" "Very Bad"]
:style :inline-clickable}
{:id :dissatisfaction-reason
:text "What is the reason for your dissatisfaction?"
:options ["Agent was rude" "Waiting times are long" "No solution for my problem" "Other"]
:style :dropdown
:depends-on {:id :experience-level :values #{"Bad" "Very Bad"}}}
{:id :dissatisfaction-other-reason
@dosbol
dosbol / ns-cheatsheet.clj
Created August 3, 2020 17:34 — forked from ghoseb/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.

Lessons learned; The nice and accurate counsel of Alex Miller, programmer

TL:DR

  • Be intentional
  • Stay connected to the problem
  • Use tables to explore alternatives
  • Make a picture

1. Read the docs!

###########
queue of 10
###########
##############
pedestal: sync
##############
10.61µs
Evaluation count : 51774 in 6 samples of 8629 calls.