Skip to content

Instantly share code, notes, and snippets.

View DanielRamosAcosta's full-sized avatar
🫒
Working from Jaén

Daniel Ramos DanielRamosAcosta

🫒
Working from Jaén
View GitHub Profile
# _______ _______ __ __
# |__ _ |__ _| \ \ / /
# | | | | \ V /
# | | | | > <
# | | | | / /\ \
# |_| |_| /_/ \_\
#
# James A. Moorer
use_bpm 60
@DanielRamosAcosta
DanielRamosAcosta / README.md
Last active May 26, 2025 20:26
Back to the Future Kata

Back to the Future Kata

Complete name: Back to the Future in the Grocery Store Kata

This kata is about managing a special grocery store inventory. The task is to keep track of fruits and vegetables, organize and sort them, but with a twist—we need to manage the inventory over time!

Every method in this kata requires a date parameter to indicate when the changes should take effect.

Your job is to create a system that can accept changes to the inventory at any date, and then allow us to see the state of the inventory at any given date.

import { BenchmarkRunResult } from "https://deno.land/std/testing/bench.ts";
function typicalDeviation(data: number[]) {
const avg = data.reduce((a, b) => a + b) / data.length;
const squareDiffs = data.map((value) => {
const diff = value - avg;
const sqrDiff = diff * diff;
return sqrDiff;
});
const avgSquareDiff = squareDiffs.reduce((a, b) => a + b) / data.length;
@DanielRamosAcosta
DanielRamosAcosta / ipValidator.js
Created November 27, 2019 15:43
Functional IP Validator
const toInteger = digitString => parseInt(digitString)
const isValidInteger = digit => !isNaN(digit)
const isGreaterOrEqualThan = n1 => n2 => n1 >= n2
const isLessOrEqualThan = n1 => n2 => n1 <= n2
const isValidIp = ip => ip
.split(".")
.map(toInteger)
.filter(isValidInteger)
.filter(isGreaterOrEqualThan(255))
package com.acidtango.javaboilerplate;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Optional;
import java.util.function.Predicate;
public class IpValidator {
Cipher::EncryptBlock
CipherAES::Encrypt
CipherAES::EncryptBlocks
Cipher::EncryptBlocks
CipherAES::Encrypt
CipherAES::Encrypt
CipherAES::Encrypt
CipherAES::Encrypt
CipherAES::Encrypt
CipherAES::Encrypt
defmodule StringCalculator do
def has_delimiter?(str) do
String.starts_with?(str, "//")
end
def extract_delimiter(str) do
{String.at(str, 2), String.slice(str, 3..-1)}
end
def replace_whitespace_with_separator(str, separator) do
import flow from 'lodash/flow'
function Toggler(toggler) {
// PRIVATE ====================================================================
function updateSelectedTypes (types) {
return {
...toggler,
types
}
import axios from "https://gist.githubusercontent.com/DanielRamosAcosta/2f773d815f5434f185c59aec1bab418c/raw/a442cdd8699e39ab9855cbaa571a79049a7b67d4/axios.ts"
// Make a request for a user with a given ID
axios.get('http://jsonplaceholder.typicode.com/users/1')
.then(response => {
// handle success
console.log("User name:", response.data.name);
})
.catch(error => {
// handle error
/**
* These typings are Axios's repo
* https://raw.githubusercontent.com/axios/axios/master/index.d.ts
*/
export interface AxiosTransformer {
(data: any, headers?: any): any;
}
export interface AxiosAdapter {