dddd
This file contains hidden or 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
| const randomDelay = () => new Promise(resolve => | |
| setTimeout(resolve, Math.random() * 100) | |
| ) | |
| // Variable | |
| let balance = 0 | |
| async function loadBalance () { | |
| // delay in getting the load balance | |
| await randomDelay() |
This file contains hidden or 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
| const arr = x => Array.from(x); | |
| const num = x => Number(x) || 0; | |
| const str = x => String(x); | |
| const isEmpty = xs => xs.length === 0; | |
| const take = n => xs => xs.slice(0,n); | |
| const drop = n => xs => xs.slice(n); | |
| const reverse = xs => xs.slice(0).reverse(); | |
| const comp = f => g => x => f (g (x)); | |
| const chunk = n => xs => | |
| isEmpty(xs) ? [] : [take(n)(xs), ...chunk (n) (drop (n) (xs))]; |
This file contains hidden or 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
| require 'action_view' | |
| module ActionView::Helpers::NumberHelper | |
| def self.number_to_words(number) | |
| numbers_to_name = { | |
| 1000000 => "million", | |
| 1000 => "thousand", | |
| 100 => "hundred", | |
| 90 => "ninety", | |
| 80 => "eighty", |
This file contains hidden or 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
| module Memoization | |
| def memoize(name) | |
| @@lookup ||= Hash.new { |h, k| h[k] = {} } | |
| fx = instance_method(name) | |
| define_method(name) do |args| | |
| return @@lookup[name][args] if @@lookup[name].include?(args) | |
| @@lookup[name][args] = fx.bind(self).call(args) | |
| end |
This file contains hidden or 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 a; | |
| import java.util.Scanner; | |
| public class Main { | |
| public final static double pi = 3.14; | |
| public static void main(String[] args) { | |
| int diametro; |
This file contains hidden or 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.Scanner; | |
| public class Main { | |
| //package Main; | |
| public static void | |
| main(String[] args) { | |
| double area, perimetro; | |
| Scanner entrada = new Scanner | |
| (System.in); |
This file contains hidden or 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 sys | |
| import time | |
| import itertools | |
| def spinning_cursor(): | |
| while True: | |
| for cursor in '|/-\\': | |
| yield cursor | |
| #spinner = spinning_cursor() |
NewerOlder