Skip to content

Instantly share code, notes, and snippets.

@xhh
xhh / exwx.exs
Last active June 21, 2022 09:59 — forked from rlipscombe/exwx.exs
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__, [], [])
@xhh
xhh / wx.ex
Created June 8, 2022 14:09 — forked from dominicletz/wx.ex
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
@xhh
xhh / AddPostgresTriggerAndFunctionForAllTables.exs
Created July 8, 2021 09:32 — forked from carterbryden/AddPostgresTriggerAndFunctionForAllTables.exs
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;
@xhh
xhh / ssl.rules
Created March 31, 2021 14:04 — forked from konklone/ssl.rules
nginx TLS / SSL configuration options for konklone.com
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email eric@konklone.com.
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
@xhh
xhh / errocodeNX.md
Created March 11, 2017 03:01 — forked from dietmarkuehl/errocodeNX.md
error_code article

Defining and Using a Symbol Analogue for Error Reporting in C++

Abstract

The use of exceptions isn't a viable error handling approach in all cases and returning codes for error handling is sometimes preferable. However, using integral types for error identification is problematic as there is no good mechanism to guarantee that each value uniquely