Skip to content

Instantly share code, notes, and snippets.

Avatar

Krzysztof Kowalczyk kjk

View GitHub Profile
@kjk
kjk / main.go
Created Oct 20, 2021
gomarkdown test (made with https://codeeval.dev)
View main.go
package main
import (
"fmt"
"github.com/gomarkdown/markdown"
"github.com/gomarkdown/markdown/parser"
)
func main() {
extensions := parser.CommonExtensions | parser.AutoHeadingIDs
@kjk
kjk / main.diff
Last active Oct 20, 2021
and description (made with https://codeeval.dev)
View main.diff
+this is a diff
-and there it is
@kjk
kjk / vercel_bug.md
Last active Oct 19, 2021
vercel "api" url bug (made with https://codeeval.dev)
View vercel_bug.md

Update: this bugs seems to be fixed.

Vercel has a bug that if you put "api" anywhere in the URL, it triggers some internal Vercel 404 error.

I discovered it on my website because I had valid page with "api" in the url and it returned internal Vercel error page instead of rendering 404.html

It happens on any website hosted on Vercel.

Example:

@kjk
kjk / main.js
Last active Oct 19, 2021
pdf.js usage (made with https://codeeval.dev)
View main.js
var pdfjsLib = require('pdfjs-dist/build/pdf');
var PdfjsWorker = require('worker-loader!pdfjs-dist/build/pdf.worker.js');
import {
DefaultAnnotationLayerFactory,
DefaultTextLayerFactory,
PDFLinkService,
PDFPageView
} from 'pdfjs-dist/web/pdf_viewer.js';
View main.go
// :glot
package main
import "fmt"
func main() {
// :show start
var s string // empty string ""
s1 := "string\nliteral\nwith\tescape characters\n"
s2 := `raw string literal
@kjk
kjk / fakemenu.c
Last active Sep 24, 2021
how to implement menu-like pop-up the right way in win32
View fakemenu.c
/*****************************************************************************
* Sample program to demonstrate how a program can display a
* popup window which does not deactivate its parent. This
* can be used for things like a magnifying glass window or
* a pseudo-menu.
*****************************************************************************/
#define STRICT
#include <windows.h>
#define COMPILE_MULTIMON_STUBS
@kjk
kjk / 3.5-chromium.txt
Last active Sep 20, 2021
clang-format styles
View 3.5-chromium.txt
kjkmacpro:sumatrapdf kjk$ clang-format -dump-config -style=Chromium
---
Language: Cpp
# BasedOnStyle: Chromium
AccessModifierOffset: -1
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
@kjk
kjk / main.txt
Created Jul 16, 2021
scratchpad.txt (made with https://codeeval.dev)
View main.txt
C:\Users\kjk\AppData\Local\Temp\sumE1DD.tmp -copy-self-to "C:\Users\kjk\src\sumatrapdf\out\dbg64\SumatraPDF.exe"
@kjk
kjk / main.go
Created Jun 22, 2021
pretty print JSON (made with https://codeeval.dev)
View main.go
package main
import (
"fmt"
"encoding/json"
"github.com/tidwall/pretty"
)
var prettyOpts = pretty.Options{
Width: 80,
View main.cc
#include <iostream>
int main()
{
int x = 1;
if (x > 0) {
std::cout << "x (" << x << ") is greater than zero\n";
}
}