Skip to content

Instantly share code, notes, and snippets.

View ivmos's full-sized avatar
💭
Hey there I’m using Github

Iván Mosquera ivmos

💭
Hey there I’m using Github
View GitHub Profile
// Define a class for video game consoles
class Console {
constructor(name, generation, graphics, sound, performance, catalog, aladdin, sonic) {
this.name = name;
this.generation = generation;
this.graphics = graphics;
this.sound = sound;
this.performance = performance;
this.catalog = catalog;
this.aladdin = aladdin;
@ivmos
ivmos / AOC2022-Day04-ByChatGPT.java
Last active December 4, 2022 09:37
AOC2022 Day04 implemented with ChatGPT
package aoc.day01;
import aoc.Day;
import java.util.ArrayList;
import java.util.List;
public class Day04 implements Day {
@Override
public String part1(List<String> input) {
@ivmos
ivmos / CustomLocalValidatorFactoryBean.kt
Created February 18, 2022 22:56 — forked from pschichtel/CustomLocalValidatorFactoryBean.kt
SuspendAwareKotlinParameterNameDiscoverer
import org.hibernate.validator.internal.engine.DefaultClockProvider
import org.springframework.core.LocalVariableTableParameterNameDiscoverer
import org.springframework.core.PrioritizedParameterNameDiscoverer
import org.springframework.core.StandardReflectionParameterNameDiscoverer
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean
import java.lang.reflect.Constructor
import java.lang.reflect.Method
import javax.validation.ClockProvider
import javax.validation.Configuration
import javax.validation.ParameterNameProvider
#!/usr/bin/env kscript
//DEPS com.google.photos.library:google-photos-library-client:1.5.0
import com.google.api.gax.core.FixedCredentialsProvider
import com.google.api.gax.rpc.ApiException
import com.google.auth.oauth2.AccessToken
import com.google.auth.oauth2.UserCredentials
import com.google.photos.library.v1.PhotosLibraryClient
import com.google.photos.library.v1.PhotosLibrarySettings
import com.google.photos.library.v1.proto.BatchCreateMediaItemsResponse
#!/usr/bin/env kscript
// This is a handy template for writing quick kotlin scripts.
// What the script does <TODO>
import kotlin.system.exitProcess
class AnsiColors { companion object { const val ANSI_RESET = "\u001B[0m"; const val ANSI_RED = "\u001B[31m"; const val ANSI_GREEN = "\u001B[32m"; const val ANSI_YELLOW = "\u001B[33m"; const val ANSI_BLUE = "\u001B[34m"; const val ANSI_PURPLE = "\u001B[35m"; const val ANSI_CYAN = "\u001B[36m"; const val ANSI_WHITE = "\u001B[37m"; } }
fun logInfo(message: String) = println("${AnsiColors.ANSI_BLUE}$message${AnsiColors.ANSI_RESET}")
fun logWarn(message: String) = println("${AnsiColors.ANSI_YELLOW}$message${AnsiColors.ANSI_RESET}")
import React, { Component } from 'react';
import { TouchableOpacity, TouchableHighlight } from 'react-native';
import { PropTypes } from 'prop-types';
/* eslint-disable no-invalid-this */
const debounce = function(callback, wait, context = this)
{
let timeout = null;
let callbackArgs = null;
## Useful Commands
Get kubectl version
kubectl version
Get cluster info:
// More about hash code
import java.util.*;
import java.lang.*;
public class Example
{
public int x;
public Example(int x) {
this.x = x;
#https://ivanmosquera.net/2017/05/15/implication-conditional-equivalence-and-biconditional-nl-and-programming-examples/
def conditional(a,b):
if a:
return b
else:
return True
print("\tp\tq\tp =>q")
for p in (True, False):
for q in (True, False):
print("%10s %10s %s" %(p,q, conditional(p, q)))