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
#!/bin/bash | |
echo "Creating test-network..." | |
docker network create test-network > /dev/null 2>&1 | |
COUNT=100 | |
echo "Starting $COUNT containers..." | |
for i in $(seq 1 $COUNT); do | |
printf . | |
docker run -d --network test-network --name test-$i nginx > /dev/null 2>&1 |
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
pub struct WebSocketHandler<H> { | |
handler: Option<H>, | |
} | |
impl<H, F> WebSocketHandler<H> | |
where | |
H: FnMut(WebSocket<Upgraded>) -> F + Send + 'static, | |
F: Future + Send, | |
{ | |
pub fn new(handler: H) -> Self { |
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
call plug#begin('~/.vim/plugged') | |
" LSP code completion | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
" Nice GUI tings | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'machakann/vim-highlightedyank' | |
Plug 'andymass/vim-matchup' |
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
use actix::{Actor, Addr, AsyncContext, Context, Handler, Message}; | |
use actix_web::{web, App, HttpResponse, HttpServer, Responder}; | |
use clokwerk::{Interval, Scheduler, TimeUnits}; | |
use std::{future::Future, time::Duration}; | |
struct JobContext<'a> { | |
inner_context: &'a mut Context<JobActor>, | |
} | |
impl<'a> JobContext<'a> { |
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
use actix::{Actor, AsyncContext, Context, Handler, Message}; | |
use actix_web::{web, App, HttpResponse, HttpServer, Responder}; | |
use clokwerk::{Scheduler, TimeUnits}; | |
use std::{future::Future, time::Duration}; | |
struct JobContext<'a> { | |
inner_context: &'a mut Context<JobActor>, | |
} | |
impl<'a> JobContext<'a> { |
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
<h1 class="mt-4 text-xl font-bold text-gray-800 text-center">Chat Demo</h1> | |
<input value="{{ @name }}" rs-change="name" placeholder="Name" type="text" class="mt-4 px-4 py-2 rounded shadow focus:outline-ingido-500" /> | |
<div class="mt-4 p-4 rounded-lg bg-white"> | |
<h2 class="text-gray-700 font-bold uppercase text-sm">Messages</h2> | |
{{ for message in @messages }} | |
<p class="text-lg font-medium">{{ message }}</p> | |
{{ end }} | |
</div> |
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
<h1 class="mt-4 text-xl font-bold text-gray-800 text-center">Timer Demo</h1> | |
<div class="mx-auto w-64 bg-white rounded-lg text-center p-4"> | |
<h1 class="text-3xl font-bold text-indigo-900 font-mono">{{ format_time(@duration) }}</h1> | |
<div class="flex items-center w-full mt-4"> | |
<button rs-click="start" class="mr-2 px-4 py-2 rounded bg-blue-400 hover:bg-blue-500 text-white font-bold shadow"> | |
Start Timer | |
</button> | |
<button rs-click="stop" class="ml-2 px-4 py-2 rounded bg-red-400 hover:bg-red-500 text-white font-bold shadow"> |
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
#[derive(Debug, Clone, LiveTemplate, PartialEq)] | |
#[alcova(template = "templates/hello.html.rlt")] | |
struct HelloTemplate { | |
options: Vec<String>, | |
selected: Option<String>, | |
search: String, | |
} | |
impl HelloTemplate { | |
fn new() -> Self { |
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
struct Template {} | |
struct TemplateData {} | |
impl LiveTemplate for Template { | |
type Data = TemplateData; | |
fn render(data: &Self::Data) -> RenderedTemplate { | |
RenderedTemplate { | |
slots: vec![ | |
Slot::Static( |
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
#[derive(Debug, PartialEq)] | |
enum Expression { | |
Literal(String), | |
CodeBlock(String), | |
} | |
#[derive(Debug, PartialEq)] | |
struct Template { | |
expressions: Vec<Expression>, | |
} |
NewerOlder