Skip to content

Instantly share code, notes, and snippets.

@kasajian
kasajian / ConcurrentExclusiveSchedulerPair_Sample.cs
Created October 30, 2024 02:02
Sample using ConcurrentExclusiveSchedulerPair
// Reference: https://stackoverflow.com/a/12069460/75129
using static System.FormattableString;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace ConcurrentExclusiveSchedulerPair_SampleA
{
@kasajian
kasajian / test.html
Created October 19, 2024 14:43
Sample HTML shows 401 Unauthorized in Dev Tools Console, but cannot get status code in client-side js
<!DOCTYPE html>
<html>
<body>
<script>
(async function () {
"use strict";
const API_ORGANIZATION="contoso"
const expiredPat = 'ts44tplifj4hbbzeitcz5dg5az4q3mpqcxqmrxo4zwlgy3scobzq'
@kasajian
kasajian / Pure Functions.md
Last active October 9, 2024 16:58
Logging and are Pure Functions necessary for FC-IS (Functional Core and Imperative Shell)

Logging and are Pure Functions necessary for FC-IS (Functional Core and Imperative Shell)

One could say a pure function has the following characteristics:

  • Deterministic: The same input values always produce the same output values
  • No side effects: The function does not change any variables or objects that existed before it was called
  • No external dependencies: The function does not read or write data from outside sources, such as files, databases, web services, or the console

And this would not be incorrect. However, rather than applying these criteria to a function in order to determine its purity, I think it's better to ask yourself and understand why is it important, and is it?

@kasajian
kasajian / ide_requirements.md
Last active October 27, 2022 19:05
What I look for in an IDE

What I look for in an IDE

As someone who experiments with different programming languages and environments, the following are the requirements I look for in IDE integration, whether for Visual Studio Code, or another IDE.

Minimum

  1. "Run" command that runs a sample piece of code, given an entry point, and exits when it's done. Be able to do this multiple times, after making changes to the source in the editor.
  2. Run under a debugger. Place a break-point somewhere in the executation path, hit F5, and make sure it breaks there. Continuing after that, should go to the end and exit (not remain in the debugger)
  3. Run a set of tests.
  4. Place a breakpoint in any test or production code that's in the execution path of a test, run a set of tests (all tests), and hit the breakpoint on the first test that hits it.
@kasajian
kasajian / Positions.md
Last active October 7, 2021 01:11
Job posting
@kasajian
kasajian / Search my gists.md
Created July 19, 2021 06:31
How to search gists

Enter this in the search box along with your search terms:

Get all gists from the user kasajian.
user:kasajian

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@kasajian
kasajian / m3-downloader.bat
Created October 23, 2020 07:18 — forked from a-sync/m3-downloader.bat
m3 archívum URL vagy M3- ill. RADIO- azonosító alapján letölti a műsort youtube-dl segítségével
@if (@a==@b) @end /*
@echo off
setlocal
if "%~1"=="/?" goto usage
if %0 == "%~0" (
title m3-downloader.bat
set /p INPUT="ID/URL: "
) else (
set "INPUT=%~1"
@kasajian
kasajian / embedded_nodejs.bat
Created October 23, 2020 07:09 — forked from a-sync/embedded_nodejs.bat
A single batch file that downloads a nodejs binary and runs the code embedded in itself. (for windows 7 and above)
if ("0"=="1") /*
@echo off
set args=%*
setlocal ENABLEDELAYEDEXPANSION
if not exist %TEMP%\node.exe (
echo DOWNLOADING RUNTIME...
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://nodejs.org/dist/latest/win-x64/node.exe', '%TEMP%\node.exe')"
echo DOWNLOAD COMPLETE!
)
@kasajian
kasajian / desktop ui technologies
Created January 23, 2020 22:03
desktop ui technologies
node:
native:
https://github.com/parro-it/libui-node
web:
https://github.com/GoogleChromeLabs/carlo
c/c++:
native:
https://github.com/andlabs/libui
web:
@kasajian
kasajian / C Promises.md
Last active October 23, 2020 09:38
promises

Promises

4557 We always imagine that a variable has a value. That is, as soon as a variable is created, it has some value, even if it's a default value. So if you have two variables, x and y, and you want to print the sum, you might code it this way:

WriteLine( x + y );

Now what if a variable's value doesn't exist right away, but will become available at some time in the future. The time in the future can be a long time, a short time or no time, but you don't know. The variable has a .Result property which will return the value, but blocking until the value is actually available. Let's say variable x is that type of a variable, so your code would now look like this:

WriteLine( x.Result + y );