Skip to content

Instantly share code, notes, and snippets.

View MiniAppleTheApple's full-sized avatar

MiniApple MiniAppleTheApple

  • Brasil RJ Rio de Janeiro
View GitHub Profile
@proudlygeek
proudlygeek / cocreteType.go
Created April 28, 2014 10:46
Opaque interfaces in Golang
package opaque
type internalBasicType int
//
// Prevents the interface to be implemented
// *outside* the package, since is lowerCase (thus private).
//
// This is best suited for API and things we don't
// wanna people to override.
@hyg
hyg / gist:9c4afcd91fe24316cbf0
Created June 19, 2014 09:36
open browser in golang
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@msikma
msikma / rfc5646-language-tags.js
Created February 26, 2015 13:51
RFC 5646 Language Tags
// List of language tags according to RFC 5646.
// See <http://tools.ietf.org/html/rfc5646> for info on how to parse
// these language tags. Some duplicates have been removed.
var RFC5646_LANGUAGE_TAGS = {
'af': 'Afrikaans',
'af-ZA': 'Afrikaans (South Africa)',
'ar': 'Arabic',
'ar-AE': 'Arabic (U.A.E.)',
'ar-BH': 'Arabic (Bahrain)',
'ar-DZ': 'Arabic (Algeria)',
@alanpeabody
alanpeabody / my_app.ex
Last active February 19, 2025 16:29
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@reborg
reborg / rich-already-answered-that.md
Last active October 17, 2025 18:52
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@martinos
martinos / monoids.ex
Last active December 5, 2022 00:02
Monoid examples in elixir
defmodule Monoid do
defmacro __using__(_opts) do
quote do
def concat([head|tail]) do
append(head, concat(tail))
end
def concat([]) do
empty
@utzig
utzig / zig-argv.md
Created October 6, 2018 12:41
zig argv
const std = @import("std");
const warn = std.debug.warn;
const allocator = std.debug.global_allocator;

pub fn main() !void {
    const args = try std.os.argsAlloc(allocator);
    defer std.os.argsFree(allocator, args);

 warn("total args: {}\n", args.len);
@esmaycat
esmaycat / message_components.md
Last active February 11, 2025 16:44
Message components

Message components

This gist shows you how to use message components in discord.py 2.0

This assumes that you know how Object Orientated Programming in Python works, if you don't know what this is then I recommend that you read this guide.

Installing

You'll need to install discord.py from git to use this (if you don't have git then google how to install it for your OS, I can't be bothered to put it in here...), if you already have this then you can skip to the next section. However if you don't please read the below

@PJUllrich
PJUllrich / big-o.md
Last active September 9, 2025 15:54
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements