This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
public class Enigma{ | |
public static String readEnigma(String path) throws Exception{ | |
StringBuilder letras = new StringBuilder(); | |
//abrir el archivo, podría no encontrarlo | |
FileInputStream in = new FileInputStream(path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.ArrayList; | |
class Carta{ | |
String palo; | |
int num; | |
public Carta(String palo,int num){ | |
this.palo = palo; | |
this.num = num; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TupleSections #-} | |
module Poptics where | |
import Prelude hiding (traverse) | |
import Control.Category ((>>>)) | |
import Control.Applicative (liftA2, Const (..)) | |
import Control.Arrow ((&&&), (|||), (***)) | |
newtype State s a = State { run :: s -> (a,s)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package parte2; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
/** | |
* @author lfborjas | |
*/ | |
public class Baraja { | |
public static String[] palos={"diamantes", "tréboles", "corazones", "espadas"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Los elementos primitivos de javascript son | |
* números | |
* strings | |
* booleans | |
* nulidades: `undefined`(implícita) y `null` (explícita) | |
*Los medios de combinación: arreglos y objetos. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#these are meant to be run in a REPL, and the java one in beanshell of something of the sort: | |
#ruby | |
[1,2,3,4].select{ |x| x.even? } | |
#python | |
[x for x in [1,2,3,4] if not x%2] | |
#or, more norvingly | |
filter(lambda x: not x%2, [1,2,3,4]) | |
#clojure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- :name insert-or-get-image! :<! :1 | |
/* :doc insert an image, or retrieve existing, and return the id, uri, and | |
public URL as determined by the provided `:bucket` and `:images-host`. | |
*/ | |
WITH new_img AS ( | |
INSERT INTO image (uri, fmt, size, device_id, os_version_id) | |
VALUES (:uri, :fmt, :size, :device-id, :os-version-id) | |
ON CONFLICT (uri) DO NOTHING | |
RETURNING id, uri, | |
gcs_uri_to_public_url(uri, COALESCE(:bucket, ''), COALESCE(:images-host, '')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loosely based on https://www.fpcomplete.com/blog/2017/12/building-haskell-apps-with-docker | |
FROM fpco/stack-build:lts-13.27 as dependencies | |
RUN mkdir /opt/build | |
WORKDIR /opt/build | |
# GHC dynamically links its compilation targets to lib gmp | |
RUN apt-get update \ | |
&& apt-get download libgmp10 | |
RUN mv libgmp*.deb libgmp.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ejercicios; | |
import java.util.ArrayList; | |
import java.util.Random; | |
import java.util.Arrays; | |
public class Conjuntos{ | |
private static ArrayList<String> union(ArrayList<String> primero, ArrayList<String> segundo){ | |
ArrayList<String> retVal = new ArrayList<String>(primero); | |
for(String worte: segundo){ | |
if(!primero.contains(worte)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*Programa que genera un arreglo con tamaño aleatorio de enteros aleatorios | |
e imprime un histograma de frecuencias | |
*/ | |
package ejercicios; | |
//clase de java para generar números aleatorios: | |
import java.util.Random; | |
//sirve para representar colecciones tabulares | |
import java.util.HashMap; | |
//contiene distintas utilidades para colecciones |
NewerOlder