This file contains 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
This file contains 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
{ | |
"files": [ | |
"index.ts" | |
], | |
"deno_args":[ | |
"--allow-net", | |
"--allow-read", | |
"--allow-write" | |
], | |
"extensions": [ |
This file contains 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 { serve } from "https://deno.land/std@0.50.0/http/server.ts"; | |
const s = serve({ port: 8000 }); | |
console.log("http://localhost:8000/"); | |
let headers = new Headers(); | |
headers.set("content-type", "text/html"); | |
for await (const req of s) { | |
req.respond({ |
This file contains 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
function MyFormSample() { | |
const form = useForm({ | |
firstName: useField({ name: "Firstname", validators: [requiredValidator] }), | |
lastName: useField({ name: "Lastname", validators: [requiredValidator] }) | |
}); | |
return ( | |
<div> | |
<TextField {...textFieldFieldProps(form.firstName)} /> | |
<TextField {...textFieldFieldProps(form.lastName)} /> |
This file contains 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 Dispatcher { | |
_callbacks: { [key: string]: (payload: IActionPayload) => void }; | |
_isDispatching: boolean; | |
_isHandled: { [key: string]: boolean }; | |
_isPending: { [key: string]: boolean }; | |
_lastID: number; | |
_pendingPayload: IActionPayload; | |
constructor() { | |
this._callbacks = {}; |
This file contains 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
// Using File.ReadAllText | |
public async Task MyMiddleWare(HttpContext context, IApplicationEnvironment env) | |
{ | |
var html = File.ReadAllText(env.ApplicationBasePath + "/Views/index.html"); | |
await context.Response.WriteAsync(html); | |
} | |
// Using FileProvider |
This file contains 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
// Inline lampda: | |
public void Configure(IApplicationBuilder app) | |
{ | |
// "" is the route - so this is just the root path | |
app.Map("", x => | |
{ | |
x.Run(m => m.Response.WriteAsync("Hello, World!")); | |
}); | |
} | |
This file contains 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
@using (Html.BeginRouteForm(Route.Stuff, FormMethod.Get, new {@class = "myForm", data_hello = "this"})) | |
{ | |
... | |
} | |
@using (Html.Form.Method(FormMethod.Get).Src(Route.Stuff).Class("myForm").Data_Hello("this")) | |
{ | |
} |
This file contains 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
<form method="get" action="https://google.com/search"> | |
<input type="hidden" name="as_sitesearch" value="deldy.dk"> | |
<input type="search" name="q" placeholder="search"> | |
<input type="submit" style="display:none;"> | |
</form> |
This file contains 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
using BitlyDotNET.Implementations; | |
using BitlyDotNET.Interfaces; | |
//NUGET: | |
// Install-Package Bitly.Net | |
//Get username and apiKey from BIT.LY - you can get it under your account, settings > advanced and then Legacy API Key. | |
public class UrlShortenerHelper | |
{ | |
public static void Setup(string username, string apiKey) |
NewerOlder