Skip to content

Instantly share code, notes, and snippets.

View kaeluka's full-sized avatar

Stephan Brandauer kaeluka

View GitHub Profile
for emoji in $(gh api /emojis | jq 'keys | .[]' | tr '"' ":"); do echo "\`$emoji\` - $emoji"; done | gh gist create -w -f all-gh-emojis.md

:+1: - 👍 :-1: - 👎 :100: - 💯 :1234: - 🔢 :1st_place_medal: - 🥇 :2nd_place_medal: - 🥈

class A {};
// Proof of concept.
//
// A class that wraps a unique_ptr and creates a copy constructor that
// allows you to copy it without the explicit move constructor.
// The move constructor will be implied. This violates the expectation
// that copying a value is free of side effects and you should therefore
// probably not use this class.
template <class T> struct moving_unique_ptr {
#include "stack.h"
#include <stdlib.h>
#include <assert.h>
typedef struct frame frame;
struct stack
{
frame *top;
int size;
  • yasnippets
  • multiple-cursors
  • ace-jump-mode
  • keyboard macros (built in)

Run M-x list-packagesRET to see a list of installable packages.

To see more packages, add the following lines at the beginning of your ~/.emacs:

@kaeluka
kaeluka / future.erl
Last active August 29, 2015 14:05
Futures in erlang
-module(future).
-export([async/1, fulfill/2, block/1, test/0]).
async(Fun) ->
F = mk(),
spawn(fun() ->
fulfill(F, Fun()) end),
F.
@kaeluka
kaeluka / horr.erl
Last active July 2, 2019 06:03
Global mutable state in erlang.
-module(horr).
-export([malloc/0, free/1, read/1, write/2, test/0]).
% You can use `malloc` to get a globally sharable, mutable cell of memory.
% A difference to C's `malloc` is that such a cell doesn't have a certain size (you can't overflow)
% Memory is initialised with the atom `null`.
malloc() ->
spawn(fun() -> mem(null) end).
% As processes are not garbage collected, you have to call `free` when you're done with your memory:
trait Foo {
fn foo();
}
impl Foo for &int {
fn foo() {
println!("&int")
}
}
{-# LANGUAGE ExistentialQuantification #-}
-- interface Foo {
-- void doFoo();
-- }
import Data.Char
-- A 'method' gets a this-ref, some args and a return type.
  1. arsoitenarosit arsteoin
  2. arsitenaristn arsten