Skip to content

Instantly share code, notes, and snippets.

@omyto
omyto / Logger.ts
Created January 6, 2025 14:50
Fastify Global Logger
import pino from 'pino'
import { FastifyBaseLogger } from 'fastify'
import { Bindings, ChildLoggerOptions } from 'fastify/types/logger'
class Logger implements FastifyBaseLogger {
private log?: FastifyBaseLogger
get level() : pino.LevelWithSilentOrString {
return this.log!.level
}
@omyto
omyto / HelloWorld.java
Created December 7, 2024 05:06 — forked from lolzballs/HelloWorld.java
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
Registered Name: https://zhile.io
License Key: 48891cf209c6d32bf4
@omyto
omyto / EncodePolyline
Created September 6, 2021 14:41 — forked from mmdumi/EncodePolyline
Encode polyline. Google Maps API v3 algorithm. Objective c.
+ (NSString *)encodeStringWithCoordinates:(NSArray *)coordinates
{
NSMutableString *encodedString = [NSMutableString string];
int val = 0;
int value = 0;
CLLocationCoordinate2D prevCoordinate = CLLocationCoordinate2DMake(0, 0);
for (NSValue *coordinateValue in coordinates) {
CLLocationCoordinate2D coordinate = [coordinateValue MKCoordinateValue];
@omyto
omyto / running-cocoapods-on-apple-silicon.md
Last active June 14, 2021 17:39
Running CocoaPods on Apple Silicon (M1)

Running CocoaPods on Apple Silicon (M1)

Clone from: https://stackoverflow.com/a/66556339

TL;DR:

  • Install your own version of Ruby with Homebrew / rbenv / RVM (e.g. brew install ruby)
  • Add it and the gems binaries to your PATH and make sure the new version is used with which ruby (should be /opt/homebrew/opt/ruby/bin/ruby instead of /usr/bin/ruby if installed with Homebrew)
  • Install CocoaPods with sudo gem install cocoapods (make sure ethon is at least version 0.13.0)
  • Run pod install
@omyto
omyto / markdown-details-collapsible.md
Created June 6, 2021 14:35 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@omyto
omyto / git-clearHistory
Last active May 31, 2021 09:42 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -S -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git
@omyto
omyto / reflect.swift
Created March 5, 2021 09:20 — forked from mchambers/reflect.swift
Basic Reflection in Swift.
// Let's define a basic Swift class.
class Fruit {
var type=1
var name="Apple"
var delicious=true
}
// We can get at some info about an instance of an object using reflect(), which returns a Mirror.
reflect(Fruit()).count
reflect(Fruit())[1].0