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 std::env; | |
const DEFAULT_PORT: u16 = 3000; | |
const DEFAULT_SERVER_MODE: &str = "DEV"; | |
fn main() { | |
let server_port = env::var("SERVER_PORT").unwrap_or(DEFAULT_PORT.to_string()); | |
let server_mode = env::var("SERVER_MODE").unwrap_or(DEFAULT_SERVER_MODE.to_string()); | |
println!( |
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 main | |
import ( | |
"bytes" | |
"context" | |
"encoding/json" | |
"errors" | |
"fmt" | |
"io/ioutil" | |
"log" |
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 size = 10.0; | |
const clr = 0.0; | |
const ps = 0.0; | |
rust | |
.then((canvas) => { | |
var nodes = document.getElementsByTagName("button"); | |
for (var i = 0; i < nodes.length; i++) { | |
nodes[i].addEventListener( |
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 std::{path::Path, sync::Arc}; | |
use swc::{ | |
self, | |
config::{JscConfig, Options}, | |
}; | |
use swc_common::{ | |
errors::{ColorConfig, Handler}, | |
SourceMap, | |
}; |
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 colored::Colorize; | |
use open::that; | |
use std::{ | |
io::prelude::*, | |
net::{TcpListener, TcpStream}, | |
}; | |
use tungstenite::{ | |
accept_hdr, | |
handshake::server::{Request, Response}, | |
}; |
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 colored::Colorize; | |
use open::that; | |
use std::{io::prelude::*, net}; | |
// TODO: Manage Request asynchronously | |
pub async fn serve(app: &str, addr: &str, open_on_browser: bool) { | |
let listener = net::TcpListener::bind(&addr) | |
.unwrap_or_else(|e| panic!("Port {} is already used: {}", &addr, e)); |
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
class VehiclesFactory { | |
static build(builder) { | |
builder.addParts(); | |
return builder.get(); | |
} | |
} | |
class CarBuilder { | |
constructor() { | |
this.car = new Car(); |
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
export enum PizzaShapes { | |
square, | |
rectangular, | |
circular, | |
} | |
export type PizzaToppings = "sausage" | "mushrooms" | "cabanossi"; | |
export type PizzaFlavor = | |
| "veggie" | |
| "meat" |
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
var app = WebApplication.Create(args); | |
app.MapGet("/reverse/{text}", RouteHandlers.Reverse); | |
app.Run(); | |
internal static class RouteHandlers | |
{ | |
public static string Reverse(string text) | |
{ |
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 re | |
def translate_g_language(text: str) -> str: | |
return re.sub(r"([aeiou])g\1", r"\1", text) | |
def main(): | |
print(f"Result: {translate_g_language(input('Enter text: '))}") |