Skip to content

Instantly share code, notes, and snippets.

@ldd
ldd / todo.js
Created October 16, 2021 07:32
todo-list familiars
function loadFont(container) {
const familiarsFont = new FontFace(
"Junction Regular",
"url(https://cors-anywhere.herokuapp.com/https://cdn.discordapp.com/attachments/617372365520896027/892619268854792202/FamIo8.ttf)"
);
familiarsFont
.load()
.then(loaded_face => document.fonts.add(loaded_face))
.catch(() =>
console.log(
// create-react-app typescript WSL
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src",

1 - Install imagemagick

  • Mac: brew install imagemagick
  • Ubuntu Linux: Follow this guide
  • If you are on windows, these instructions should work on WSL (windows subsystem for linux)

Updated Script

1- Save the following script as split-icons.sh

@ldd
ldd / formatted_date.rb
Created April 8, 2020 18:19
jekyll plugin to format date
module Jekyll::CustomFilter
def formatted_date(date)
# date = Time.parse(string_date)
ending = 'th'
case date.day % 10
when 1
ending = 'st'
when 2
ending = 'nd'
when 3
@ldd
ldd / ttf-to-png.md
Created February 26, 2020 01:37
Convert ttf to png

steps

  • get a valid ttf file, or assets like this one
  • get alphabet, for example:
     const s = "";
     for(let i=0; i < 76; i++1){
     if(i % 16 === 0) s += "\n";
     s += String.fromCharCode(47 + i);

}

@ldd
ldd / linked_list.c
Created August 5, 2019 03:59
double linked list with XOR
#include<stdlib.h>
#include<stdio.h>
struct Node {
int data;
struct Node *both;
};
// https://stackoverflow.com/a/26569748
struct Node * xor(struct Node *m, struct Node *n){
@ldd
ldd / chess_ex.js
Created July 31, 2019 22:41
Chess checker
function encode(p, p2) {
let t = 0;
t = (t << 6) | p;
t = (t << 6) | p2;
return t;
}
function decode(s) {
return [s & (2 ** 6 - 1), s >> 6];
}
@ldd
ldd / ghost.js
Last active July 23, 2019 22:39
cute ghost idea
//////////////////
// basic Trie implementation
//////////////////
function Trie() {
this.head = { key: '', children: {} }
}
Trie.prototype.add = function (key) {
@ldd
ldd / day1.js
Created December 4, 2017 14:25
Advent of code - Day 1 (javascript)
// day 1
const day1part1 = s => s
.split('')
.filter((el,i,A)=>(el===A[(i+1) % A.length] ))
.reduce((p,n)=>p+(+n),0)
const day1part2 = s => s
.split('')
.filter((el,i,A)=>(el===A[(i+A.length/2) % A.length]))
.reduce((p,n)=>p+(+n),0)
@ldd
ldd / day_one.ex
Created December 4, 2017 14:23
Advent of code - Day 1
defmodule ElixirPlayground.DayOne do
@input "./lib/elixir_playground/input/day1.txt"
defp parseInput do
@input
|> File.read!
|> String.trim
|> Kernel.to_charlist
end