Skip to content

Instantly share code, notes, and snippets.

View fredshonorio's full-sized avatar
💭
🌲

Frederico Honório fredshonorio

💭
🌲
View GitHub Profile
@fredshonorio
fredshonorio / remote.scala
Last active March 11, 2023 17:59
remote thingy for calico
package remote
import cats.effect.*
import cats.syntax.all.*
import fs2.dom.*
import calico.*
import calico.html.io.{*, given}
import fs2.concurrent.*
import fs2.*
@fredshonorio
fredshonorio / hello.hs
Created February 10, 2018 21:23
Haskell Script
#!/usr/bin/env stack
{- stack script --resolver lts-10.1 --install-ghc
--package <package dependency 1>
--package <package dependency 2>
-}
main :: IO ()
main = do
putStrLn "Hello"
CREATE FUNCTION fixUtf8Chars(str TEXT) RETURNS TEXT
BEGIN
SET str = REPLACE(str, CHAR(0xC383C2A9), CHAR(0xC3A9)); -- é
SET str = REPLACE(str, CHAR(0xC383C289), CHAR(0xC389)); -- É
SET str = REPLACE(str, CHAR(0xC383C2A8), CHAR(0xC3A8)); -- è
SET str = REPLACE(str, CHAR(0xC383C288), CHAR(0xC388)); -- È
SET str = REPLACE(str, CHAR(0xC383C2AA), CHAR(0xC3AA)); -- ê
SET str = REPLACE(str, CHAR(0xC383C28A), CHAR(0xC38A)); -- Ê
SET str = REPLACE(str, CHAR(0xC384C296), CHAR(0xC496)); -- Ė
SET str = REPLACE(str, CHAR(0xC384C297), CHAR(0xC497)); -- ė
@fredshonorio
fredshonorio / convert_mobile.py
Last active August 29, 2015 14:07
Converts images to mobile resolutions.
#!/bin/usr/python
# This script converts images to lower resolutions for android and ios.
# It assumes the image is in 4x/xxxhdpi
# Requires imagemagick.
import subprocess
import sys
import os
@fredshonorio
fredshonorio / base64url.php
Last active August 29, 2015 14:02
Yet another base64url for php
<?php
function base64url_encode($data) {
if (!mb_check_encoding($data, "ASCII"))
throw new InvalidArgumentException("Arguments can only contain ASCII characters.");
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}