Skip to content

Instantly share code, notes, and snippets.

View dragonnomada's full-sized avatar
😁
Working

Alan Badillo Salas dragonnomada

😁
Working
View GitHub Profile
import java.util.Scanner;
public class TiendaFrutas {
public static void main(String[] args) {
double kilosManzana = 0.0;
double precioManzana = 0.0;
double totalKilosVendidos = 0.0;
double totalDineroAcumulado = 0.0;
# Define the function sortList(<numbers>)
# <numbers> - List of numbers
# return the sorted list of <numbers>
def sortList(numbers):
# Create a empty list
sorted_numbers = []
# Get the size of the list of numbers
size = len(numbers)
# Repeat `size` times
for i in range(size):
@dragonnomada
dragonnomada / manifest.json
Last active May 24, 2021 15:44
Ejemplo de un archivo de manifiesto
{
"name": "App One PWA",
"short_name": "AppOnePWA",
"description": "Esta aplicación muestra como usar las PWA",
"icons": [
{
"src": "icon/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
@dragonnomada
dragonnomada / app-one.html
Created May 24, 2021 15:15
HTML Standard Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My App</title>
</head>
<body>
<h1>Hello world!</h1>
import { useReducer, useState } from "react";
import "./styles.css";
function useCounter() {
const [count, setCount] = useState(0);
return {
count,
increment() {
setCount(count + 1);
@dragonnomada
dragonnomada / st-demo-app.js
Created May 5, 2021 16:46
Plantillas de Texto VI
const app = createApp`
source: https://randomuser.me/api
query: ${config => config.query}
context: ${data => data.results[0]}
id: ${config.id}
view:
--
<h1 onclick="@click">
Hola me llamo #firstname y tengo #age años
</h1>
@dragonnomada
dragonnomada / st-css-processor.js
Created May 5, 2021 16:28
Plantillas de Texto V
function css(strings, ...values) {
return context => {
let text = "";
for (let i = 0; i < strings.length; i++) {
text += strings[i];
if (typeof values[i] === "function") {
text += `${values[i](context || {})}`;
} else {
text += `${values[i] || ""}`;
}
@dragonnomada
dragonnomada / st-make-object.js
Created May 5, 2021 16:05
Plantillas de Texto IV
function makeObject(strings, ...values) {
let object = {};
for (let i = 0; i < strings.length; i++) {
const key = strings[i].trim();
if (key) {
const value = values[i];
object[key] = value;
}
}
return object;
@dragonnomada
dragonnomada / fun-string-template.js
Created May 5, 2021 15:48
Plantillas de Texto III
function ConcatenaYSuma(strings, ...values) {
const suma = values.reduce((suma, value) => suma + value, 0);
const texto = strings.join("*");
return [texto, suma];
}
const [texto, suma] = ConcatenaYSuma`a ${1} b ${2} c ${2 ** 10} d ${Math.cos(0)}`;
console.log(texto); // "a * b * c * d *"
`Hola ${name}, ¿Es cierto que tienes ${age} años?`
// TEXTO INYECCIÓN TEXTO INYECCIÓN TEXTO
// TEXTO: "Hola "
// INYECCIÓN: name
// TEXTO: ", Es cierto que tienes "
// INYECCIÓN: age
// TEXTO: " años?"