Skip to content

Instantly share code, notes, and snippets.

💭
Functional Programmer for hire. F#, Scala, Kotlin. For web, mobile, cloud etc.

Kunjan Dalal kunjee17

💭
Functional Programmer for hire. F#, Scala, Kotlin. For web, mobile, cloud etc.
Block or report user

Report or block kunjee17

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View the-coming-of-age-of-angular-component.css
.flex-container {
display: flex;
flex-wrap: nowrap;
background-color: DodgerBlue;
}
.flex-container > div {
background-color: #f1f1f1;
width: 100px;
margin: 10px;
View the-coming-of-age-of-angular-component.html
<h1>{{title}}</h1>
<h2>My favorite hero is: {{myHero.name}}</h2>
<p>Heroes:</p>
<ul>
<li *ngFor="let hero of heroes">
{{ hero.name }}
</li>
</ul>
<p *ngIf="heroes.length > 3">There are many heroes!</p>
View the-coming-of-age-of-angular-component.ts
import { Component } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'app-root',
templateUrl: './Component.html',
styleUrls : ['./Component.css']
})
export class AppComponent {
View the-coming-of-age-of-angular-ngmodule.ts
// imports
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
import { ItemDirective } from './item.directive';
View Fable.fs
let fizzBuzz x =
match x with
| _ when (x % 15) = 0 -> "FizzBuzz"
| _ when (x % 3) = 0 -> "Fizz"
| _ when (x % 5) = 0 -> "Buzz"
| _ -> ""
let fizzBuzzTo max =
[1..max]
|> List.iter (fun number -> printfn "%d %s" number (fizzBuzz number))
View saturn.fs
let topRouter = scope {
pipe_through headerPipe
not_found_handler (text "404")
get "/" helloWorld
get "/a" helloWorld2
getf "/name/%s" helloWorldName
getf "/name/%s/%i" helloWorldNameAge
//scopes can be defined inline to simulate `subRoute` combinator
View freya.fs
let users =
freyaMachine {
methods [ GET; OPTIONS; POST ]
availableMediaTypes MediaType.json
doPost createUser
handleOk listUsers }
View giraffe.fs
open Giraffe
let webApp =
choose [
route "/ping" >=> text "pong"
route "/" >=> htmlFile "/pages/index.html" ]
type Startup() =
member __.ConfigureServices (services : IServiceCollection) =
// Register default Giraffe dependencies
View suave.fs
open System
open System.Threading
open Suave
[<EntryPoint>]
let main argv =
let cts = new CancellationTokenSource()
let conf = { defaultConfig with cancellationToken = cts.Token }
let listening, server = startWebServerAsync conf (Successful.OK "Hello World")
View nancyfx.fs
module viewfiles.Main
open System
open Nancy.Hosting
type DemoApp () =
inherit NancyModule()
do
let Get = base.Get
Get.["/"] <- fun parameters -> "Hello from Nancy" :> obj
You can’t perform that action at this time.