Skip to content

Instantly share code, notes, and snippets.

@tonyallan
tonyallan / $README.md
Last active Apr 2, 2022
Python 3 update for Peter Norvig's Python Lisp
View $README.md
python3 lispytest.py
python3 lispy.py factorial.lsp

Source pages are:

  • https://norvig.com/lispy.html
  • https://norvig.com/lispy2.html
@JustinGrote
JustinGrote / MandatoryProperties.ps1
Last active Oct 25, 2021
A Powershell Class with Mandatory Properties by Default
View MandatoryProperties.ps1
using namespace System.Collections
using namespace System.Management.Automation
using namespace System.ComponentModel.DataAnnotations
using namespace System.Runtime.Serialization
class MandatoryProperties {
MandatoryProperties([IDictionary]$properties) {
$this.GetType().GetProperties([System.Reflection.BindingFlags]'Instance,Public') | ForEach-Object {
$propertyName = $PSItem.Name
[bool]$isOptional = $PSItem.GetCustomAttributes([OptionalFieldAttribute], $true).count -gt 0
if (
@calicoday
calicoday / playground.js
Last active Nov 12, 2021
Refactored tree-sitter playground.js
View playground.js
// Dev switch for loading prev state or force canned eg.
let activateSaveState = true;
let showParseCount = true;
// Prelim sample input, drawn from the cli/src/tests/query_test.rs (as-is, excess space).
const eg = {
lang: 'javascript',
code: `
class Person {
// the constructor
@bitonic
bitonic / vectorized-atan2f.cpp
Last active Jul 21, 2022
Vectorized & branchless atan2f
View vectorized-atan2f.cpp
// Copyright (c) 2021 Francesco Mazzoli <f@mazzo.li>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@thpryrchn
thpryrchn / Readme.txt
Last active Aug 29, 2022 — forked from ayyybe/ccdl.command
Adobe Offline Package Generator v0.1.4 (macOS only)... Added M1 https://github.com/Drovosek01/adobe-packager if you want to install it another way.
View Readme.txt
No Longer Maintaining this.... Get from https://github.com/Drovosek01/adobe-packager
View directed_graph.ts
class DirectedGraph<T> {
readonly edges: Map<T, Set<T>> = new Map();
addAll(from: T, ...to: T[]) {
let dependencies = this.edges.get(from);
if (dependencies == null) {
dependencies = new Set();
this.edges.set(from, dependencies);
}
Sets.addAll(dependencies, to);
@mmozeiko
mmozeiko / shader.hlsl
Last active May 15, 2022
compute shader for rendering monospaced glyphs in grid
View shader.hlsl
//
struct TerminalCell
{
// cell index into GlyphTexture, should be two 16-bit (x,y) values packed: "x | (y << 16)"
uint GlyphIndex;
// 0xAABBGGRR encoded colors, nonzero alpha for Foreground indicates to render colored-glyph
// which means use RGB values from GlyphTexture directly as output, not as ClearType blending weights
uint Foreground;
View fifo-queue.ts
/**
* Implement a simple FIFO queue (first-in-first-out)
*
* Requirements:
* 1. It must work with a single queue;
* 2. You must simulate a long-duration operation on the enqueue function.
* For the interview porpuses each enqueue function must have a 1 second execution.
* You may use timeout to achieve that.
* 3. You must use typescript types;
*
@Egor-Skriptunoff
Egor-Skriptunoff / how_to_install_lua_and_luajit_on_windows.md
Last active Oct 28, 2022
How to install Lua and LuaJIT on Windows
View how_to_install_lua_and_luajit_on_windows.md

How to install Lua and LuaJIT on 64-bit Windows

  1. Download the latest Lua and LuaJIT sources

    • Create temporary folder for Lua sources.
      I assume you would use C:\Temp\ folder.

    • Visit Lua FTP webpage and download the latest Lua source archive, currently it is lua-5.4.3.tar.gz

  • Use suitable software (7-Zip, WinRar, WinZip or TotalCommander) to unpack the archive.
@msteen
msteen / print-lezer-tree.ts
Last active Jul 28, 2022
Print Lezer Trees
View print-lezer-tree.ts
// MIT License
//
// Copyright (c) 2021 Matthijs Steen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: