json = """
[
{
"k1": "v1",
"k2": {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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__, [], []) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list = [ | |
%{id: 1, k: "k1", name: "name a", text: "text a"}, | |
%{id: 1, k: "k1", name: "name b", other: "other b"}, | |
%{id: 1, k: "k2", name: "name k2", other: "other k2"} | |
] | |
keys = [:id, :k] | |
list | |
|> Enum.group_by(&Map.take(&1, keys)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 [email protected]. | |
# 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 { |
This is an OpenPGP proof that connects my OpenPGP key to this Github account. For details check out https://keyoxide.org/guides/openpgp-proofs
[Verifying my OpenPGP key: openpgp4fpr:87D72037C1F42A14612A9E526BFE9E907DEFBBB6]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro comp* | |
"The left-to-right version of comp. | |
Takes a set of functions and returns a fn that is the composition | |
of those fns. The returned fn takes a variable number of args, | |
applies the leftmost of fns to the args, the next | |
fn (left-to-right) to the result, etc." | |
[& fns] | |
`(comp ~@(reverse fns))) |
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
I hereby claim:
- I am xhh on github.
- I am xhh (https://keybase.io/xhh) on keybase.
- I have a public key whose fingerprint is DA39 792E 3E51 743A 5BCA 49E1 F703 4D9F 9D65 BD6E
To claim this, I am signing this object:
NewerOlder