Skip to content

Instantly share code, notes, and snippets.

View rept0id's full-sized avatar
🐢
4, 8, 15, 16, 23, 42

Rantouan Achmet rept0id

🐢
4, 8, 15, 16, 23, 42
View GitHub Profile
// Odin Error Challenge in F#
// see: https://rm4n0s.github.io/posts/3-error-handling-challenge/#odins-teachings-in-action
// try pasting the code into: https://sharplab.io/
type F1_Error =
| None
| Account_Is_Empty
| Investment_Lost
type F2_Error =
@rendello
rendello / _utf8_case_data.rs
Last active March 11, 2025 21:53
Unicode codepoints that expand or contract when case is changed in UTF-8. Good for testing parsers. Includes the data `utf8_case_data.rs` and the script to generate it, `generate_utf8.py`.
/*
Copyright (c) 2024 Rendello
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
@adtac
adtac / Dockerfile
Last active April 7, 2025 15:29
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@papazetis
papazetis / at-a-glance.php
Last active February 1, 2021 18:12
Add Custom Post Types to "At a Glance"
<?php
/**
* Add custom post types count action to WP Dashboard (At a Glance)
*/
function add_cpt_glance_items( $items ) {
$args = array(
'public' => true, // Showing public post types only
'_builtin' => false // Except the build-in wp post types (page, post, attachments)
);
@bellbind
bellbind / index.html
Last active November 12, 2022 14:30
[javascript][browser] Simple Turing Pattern simulator
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<script src="script.js" defer="defer"></script>
</head>
<body>
</body>
</html>
@amamdouh2k15
amamdouh2k15 / WpfNonBlockingUIThreadWithFeedback.cs
Created January 15, 2017 12:46
Wpf Non Blocking UI Thread With Feedback
var task = Task.Factory.StartNew(() =>
{
//time consuming task
});
task.ContinueWith((t) =>
{
//TODO when task finishes
}, TaskContinuationOptions.ExecuteSynchronously);
@swayvil
swayvil / data-example.json
Last active December 5, 2024 14:18
D3.js collapsing tree with boxes
{
"tree" : {
"nodeName" : "NODE NAME 1",
"name" : "NODE NAME 1",
"type" : "type3",
"code" : "N1",
"label" : "Node name 1",
"version" : "v1.0",
"link" : {
"name" : "Link NODE NAME 1",
@evalphobia
evalphobia / README.md
Last active April 22, 2025 12:37
Golang Benchmark: gob vs json

tl;dr

  • JSON is faster for small size data
    • map (key size < 50 and Unmarshalling intensive workload)
    • single struct
  • gob is faster for big size data
    • map (key size > 50 or Marshalling intensive workload)
    • slice

(old) about

@jeserodz
jeserodz / mongo-express-config.js
Created January 22, 2016 14:22
Example config file for mongo-express
/*
This is an example config file for mongo-express (https://www.npmjs.com/package/mongo-express)
Should work without modifying if your mongodb server users are defaults
How to use:
1. Copy this file in your app/node_modules/mongo_express directory
2. Rename to config.js
*/
'use strict';
@lotsofcode
lotsofcode / prepend-child.js
Created July 31, 2014 14:30
JavaScript implementation of "prependChild"
Element.prototype.prependChild = function(newElement) {
return this.insertBefore(newElement, this.firstChild);
};