Skip to content

Instantly share code, notes, and snippets.

use futures::{StreamExt};
use std::time::Duration;
use async_std::task;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + 'static>> {
let data:Vec<u32> = (0..50).collect();
println!("Waiting...");
@LeonAlvarez
LeonAlvarez / FizzBuzz.js
Last active August 13, 2020 11:57
FizzBuzz only 1 condition
const printNumb = n => {
const words = [n, "IT", "Ambit", "FamiliaAmbit"];
const index = (n%3==0)*2 + (n%5 ==0);
return words[index]
}
for (let i = 1; i < 101; i++) {
console.log(printNumb(i))
}
@LeonAlvarez
LeonAlvarez / consume.js
Created August 19, 2019 14:53
consume string
const consumeAListOfRules = (str, topLevel) => {
let rules = [];
while (str.consume()) {
try {
const rule = consumeStringRule(str, topLevel);
if (rule) {
reules.push(rule)
}
} catch (error) {
return rules;
@LeonAlvarez
LeonAlvarez / consume.js
Created August 19, 2019 14:25
consume string rule
const consumeAListOfRules = (str, topLevel) => {
let rules = [];
while (str.consume()) {
try {
const rule = consumeStringRule(str, topLevel);
if (rule) {
reules.push(rule)
}
} catch (error) {
return rules;
@LeonAlvarez
LeonAlvarez / vhost.conf.tpl
Last active June 29, 2019 15:50
nignx conf\
---
---
server {
listen <%= ipV4 ? `*${ipV4}` : '' %>:443 ssl http2;
listen [::<%= ipV6 || '' %>:]:443 ssl http2;
server_name <%= domain %>;
set $base /var/www/<%= domain %>;
<?php
namespace App\Bot\Conversations;
use Mpociot\BotMan\Button;
use Mpociot\BotMan\Conversation;
use Mpociot\BotMan\Question;
class SimpleEditConversation extends Conversation
{
protected $cont;
{
"100": "💯",
"1234": "🔢",
"grinning": "😀",
"grimacing": "😬",
"grin": "😁",
"joy": "😂",
"smiley": "😃",
"smile": "😄",
"sweat_smile": "😅",
<!DOCTYPE html>
<html>
<head>
<title>Place Autocomplete Address Form</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
</head>
<body>
<div id="locationField">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
html,
body {