Skip to content

Instantly share code, notes, and snippets.

View go-cristian's full-sized avatar
💭
Never stop learning!

Cristian Gómez go-cristian

💭
Never stop learning!
View GitHub Profile
@Composable
fun ExampleDialog() {
val scope = rememberCoroutineScope()
val keyboardController = LocalSoftwareKeyboardController.current
val focusRequester = remember { FocusRequester() }
val textState = remember { mutableStateOf(TextFieldValue()) }
LaunchedEffect(Unit) {
scope.launch {
delay(200)
@Composable
fun SelectionPill(
option: ToggleButtonOption,
selected: Boolean,
onClick: (option: ToggleButtonOption) -> Unit = {}
) {
Button(
onClick = { onClick(option) },
colors = ButtonDefaults.buttonColors(
backgroundColor = MaterialTheme.colors.background,
@go-cristian
go-cristian / djisktra.js
Created October 16, 2021 12:50
Exploring Dijsktra's algorithm for finding the shortest path
const solution = new Set()
class Path {
constructor(graph) {
this.vertices = new Set()
this.edges = {}
this.distances = {}
fun main() {
println(palindromeIndex("aaa"))
}
fun palindromeIndex(s: String): Int {
val reversed = s.reversed()
if (s == reversed) return -1
for (i in 0 until s.length) {
var countLeft = 0
function flatlandSpaceStations(n, c) {
let max = 0
if (n == c.length) {
return 0
}
for(let i = 0; i < n; i++){
var min = Math.abs(i - c[0])
@go-cristian
go-cristian / solution.js
Created September 2, 2021 23:21
Solution of some code interview for the @acme company
function solve(ip, arr) {
let min = 0
let max = ip
arr.forEach(tuple => {
const i = tuple[0] // 5
const j = tuple[1]
if (i > min) {
const newMax = i - 1
if (newMax < max){
max = i - 1
tap "adoptopenjdk/openjdk"
tap "havoc-io/mutagen"
tap "heroku/brew"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
tap "shopify/shopify"
tap "versent/taps"
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
override func loadView() {
let view = UIView()
view.backgroundColor = .white
import kotlin.reflect.KClass
fun main() {
start {
factory<Client>{ FakeClient() }
factory<Service>{ FakeService(get()) }
}
val service: Service by inject()
service.call()
# Crack the code, and write a function to decode
# any new messages you receive from mystery envelopes.
def puzzle(encoded_message):
encoded_lowercase = encoded_message.lower()
plaintext = ''
for i in range(len(encoded_lowercase)):
ascii = ord(encoded_lowercase[i])
if ascii >= 97 and ascii<=122: