Skip to content

Instantly share code, notes, and snippets.

View gabrielhora's full-sized avatar

Gabriel Hora gabrielhora

View GitHub Profile
@gabrielhora
gabrielhora / address_cache.go
Last active October 10, 2023 08:40
address_cache.go
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"github.com/redis/go-redis/v9"
"time"
)
@gabrielhora
gabrielhora / address_cache.kt
Last active October 10, 2023 08:33
address_cache.kt
package com.shiftmove.geocoder2
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import redis.clients.jedis.JedisPooled
import java.util.Locale.US
private const val coordinatePrecision = 4
private const val addressTTL = 2628000L
@gabrielhora
gabrielhora / yardoc_cheatsheet.md
Created June 15, 2020 23:02 — forked from phansch/yardoc_cheatsheet.md
Improved YARD cheatsheet
@gabrielhora
gabrielhora / Vagrantfile
Created August 25, 2019 23:12
Vagrantfile for Ruby
LOCAL_RUBY_VERSION = File.read('.ruby-version')
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.network "forwarded_port", guest: 3000, host: 3000
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
vb.cpus = 2
end
{"lastUpload":"2021-07-05T07:59:11.903Z","extensionVersion":"v3.4.3"}
//
// AStar.m
//
// Created by Gabriel Hora (@gabriel_hora) on 27/01/11.
// You can copy, change or whatever, just remeber to leave the credits
//
#import "AStar.h"
@implementation PathNode
//
// AStar.h
//
// Created by Gabriel Hora (@gabriel_hora) on 27/01/11.
// You can copy, change or whatever, just remeber to leave the credits
//
//==============================================================================
//
// Implementation based on the great tutorial from Patrick Lester
// http://www.policyalmanac.org/games/aStarTutorial.htm
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *gitRevision = [infoDictionary objectForKey:@"BuildRevision"];
NSString *appVersion = [infoDictionary objectForKey:@"CFBundleVersion"];
NSLog(@"My GIT Revision is: %@, and myApp version is: %@",gitRevision,appVersion);
GIT=/usr/local/git/bin/git GITOPTIONS="--pretty=oneline --abbrev-commit" CUT=/usr/bin/cut /usr/libexec/PlistBuddy -c "Set :BuildRevision `$GIT log -1 $GITOPTIONS | $CUT -c1-7`" \ ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}
NSString *str = @"http://test.com/ lalélí aaaa";
str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"Escaped URL: %@",str);