Skip to content

Instantly share code, notes, and snippets.

@naxmefy
naxmefy / sum-numerics-in-string.js
Created April 22, 2021 22:19
sum all numerics in a sentence (string with spaces)
print(readline().match(/\d+/g).reduce((p,c)=>p+(+c),0))
@naxmefy
naxmefy / find-char.js
Last active April 22, 2021 22:03
found avg char in a word
r=readline().split``
console.log(String.fromCharCode(Math.round(r.reduce((p,c)=>{
console.error(c, c.charCodeAt())
return p+c.charCodeAt()
},0)/r.length)))
@naxmefy
naxmefy / check.py
Created April 22, 2021 21:53
shortest distance of points to 0,0
import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
n = int(input())
clos=''
mini=999999999
for i in range(n):
@naxmefy
naxmefy / drink-straw.js
Created April 22, 2021 21:14
just drink with a straw, or without. As latte?
r=readline;d=r();s=+r()
print(`____${'_|'[s]}____
\\ /
\\ ${d} /
\\___/`)
host chatty
HostName url.cloudbla
User usernamebla
f=n=>n<=-1?-1:n==0?1:n*f(n-1)
// f(5) => 120
/**
* @param {string} s the sentence
* @returns {number} amount of double letter words in the given sentence
*/
function doubleLetterWords(s) {
return s.split(' ').map(w => w.match(/(.)\1/m)?1:0).reduce((a,b)=>a+b)
}
// e.g
// doubleLetterWords("letter cool all rofl") => 3
function decimalToReducedFraction(d) {
for(n=1;d*n%1!==0;n++);
return [d*n,n];
}
@naxmefy
naxmefy / .air.toml
Last active October 2, 2020 10:38
Makefile for Golang Project with NPM Client, Air for backend development, Docker build, Heroku Deployment
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format
[build]
exclude_dir = ["assets", "tmp", "vendor", "client/node_modules", "client"]
import 'package:flutter/material.dart';
import 'package:simple_animations/simple_animations/controlled_animation.dart';
import 'package:simple_animations/simple_animations/multi_track_tween.dart';
class FadeAnimation extends StatelessWidget {
final double delay;
final Widget child;
const FadeAnimation(this.delay, this.child);