Skip to content

Instantly share code, notes, and snippets.

@rychale
rychale / Makefile
Created February 13, 2022 18:44
Calling a simple NIF function every 0.1 seconds two times in a row results in different latency
CXX ?= g++
ERLANG_PATH = $(shell erl -eval 'io:format("~s", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version), "/include"])])' -s init stop -noshell)
OBJECTS = $(patsubst c_libs/%.cpp,build/%.o,$(wildcard c_libs/*.cpp))
all: priv/native.so
dirs:
mkdir -p build
@EvercyanRBX
EvercyanRBX / SoftShutdown2.lua
Last active April 22, 2024 22:08
SoftShutdown v1.21
--[[
Evercyan @ June 27, 2023
SoftShutdown2 v1.21
Read more..
https://devforum.roblox.com/t/softshutdown2/1156844
]]
--> Services
local TeleportService = game:GetService("TeleportService")
@dominicletz
dominicletz / wx.ex
Created October 5, 2020 12:35
wx.ex
defmodule Wx do
@vsn "0.0.2"
@author "Onorio Catenacci"
@author "Dominic Letz"
@last_revision_date "22 May 2019"
@moduledoc """
Elixir version of the constants found in the wx.hrl file
"""
import Bitwise
require Record
@alexdesousa
alexdesousa / pub_sub.ex
Last active July 19, 2023 16:48
Small pubsub implementation using pg2
defmodule PubSub do
@moduledoc """
This module defines the basic pub-sub functions.
"""
@typedoc """
Channel name.
"""
@type channel :: term()
@borkdude
borkdude / sci_google_cloud.js
Last active March 1, 2020 13:21
Google cloud function running sci
const { evalString } = require("@borkdude/sci");
let printlnArgs = [];
function println(...args) {
printlnArgs.push(args.map(arg => arg.toString()).join(" "));
}
exports.evalClojureExpr = (req, res) => {
const { text } = req.body;
@carterbryden
carterbryden / AddPostgresTriggerAndFunctionForAllTables.exs
Last active August 30, 2024 19:17
Elixir Phoenix Postgresql migration to add triggers for pubsub to run on every CRUD operation on every table. If a new table is added, it'll automatically add a trigger to that table too.
defmodule MyApp.Repo.Migrations.AddPostgresTriggerAndFunctionForAllTables do
use Ecto.Migration
def up do
# Create a function that broadcasts row changes
execute "
CREATE OR REPLACE FUNCTION broadcast_changes()
RETURNS trigger AS $$
DECLARE
current_row RECORD;
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active September 19, 2024 07:14
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@cscalfani
cscalfani / MonoidsInHaskellAnIntroductions.md
Last active July 10, 2024 13:57
Monoids in Haskell, an Introduction

Monoids in Haskell, an Introduction

Why should programmers care about Monoids? Because Monoids are a common pattern that shows up over and over in programming. And when patterns show up, we can abstract them and leverage work we've done in the past. This allows us to quickly develop solutions on top of proven, stable code.

Add Commutative Property to a Monoid (Commutative Monoid) and you have something that can be executed in parallel. With the end of Moore's Law, parallelism is our only hope to increasing processing speeds.

What follows is what I've learned after studying Monoids. It is hardly complete, but hopefully will prove to be helpful as an introduction for others.

Monoid Lineage

@rlipscombe
rlipscombe / exwx.exs
Created November 26, 2017 16:08
Using wxWidgets from Elixir
#!/usr/bin/env elixir
defmodule Canvas do
@behaviour :wx_object
@title "Canvas Example"
@size {600, 600}
def start_link() do
:wx_object.start_link(__MODULE__, [], [])
@andreapavoni
andreapavoni / .deliver_config
Created May 22, 2017 08:53
Edeliver configuration to deploy a Phoenix app compiling and digesting assets locally
# MYAPP/.deliver/config
APP="<APP NAME>"
MAIN_HOST="<BUILD & PRODUCTION HOST>"
MAIN_USER="<MAIN USER FOR BUILD AND DEPLOY>"
BUILD_HOST="${MAIN_HOST}"
BUILD_USER="${MAIN_USER}"
BUILD_AT="/tmp/edeliver/${APP}/builds"