asp.net (2) atom (4) crawling (1) dom (1) google search (1) HTML (5) JS (2) JSON (4) Pit (2) sitemap (1) uri (2) URL (1) web (11) web crawler (2) WebClient (2) webcrawling (1) websharper (1) XML (6)

Snippets in category Web

  • Parallel Sitemap Test Runner

    A sitemap-based url tester that runs in parallel.

    35 people like this
    Posted: 1 years ago by Ryan Riley

  • Minimal XML DSL

    This snippet provides a very small internal DSL for creating and querying XML using the underlying XLinq classes.

    230 people like this
    Posted: 1 years ago by Blake Coverett

  • Setting the user agent of a Web request

    Some Web sites deny requests that aren't sent by recognized browsers and search engine crawlers. Setting the user agent header of the request is usually sufficient for bypassing this restriction.

    20 people like this
    Posted: 1 years ago by Taha Hachana

  • Convert an object to json, and json to object

    There is a namespace System.Runtime.Serialization.Json To serialize generic object you can do like this...

    40 people like this
    Posted: 1 years ago by Tuomas Hietanen

  • Clojure's Atoms

    Clojure's Atoms are ref like structures, with the addition of (Compare And Swap) update semantics

    17 people like this
    Posted: 1 years ago by Nick Palladinos

  • Clojure's Atoms

    Clojure's Atoms are ref like structures, with the addition of (Compare And Swap) update semantics

    16 people like this
    Posted: 1 years ago by Nick Palladinos

  • URL Canonicalization

    This function produces safe URLs for Web requests or URI construction. It forces the pattern: http:// + www. OR subdomain. + domain + absolute path. When used in an application that takes URLs as input, the user would be able to type "example.com" instead of "http://example.com" or "http://www.example.com". It also supports domains like google.co.uk or google.com.au.

    8 people like this
    Posted: 1 years ago by Taha Hachana

  • Uri Parser

    A Uri parser using the Cashel library [1]. This implementation is using ArraySegment<byte> as the underlying state, as I'm using it within a server, but it would be trivial to switch it to using a list. Also, note that I am not parsing the Uri into any specific structure, though that, too, would be trivial. For my current purposes, I just needed to validate the Uri. [1] https://github.com/panesofglass/cashel

    20 people like this
    Posted: 1 years ago by Ryan Riley

  • Composable WCF Web API using Async

    A functional wrapper around the new WCF Web APIs (http://wcf.codeplex.com/). Composition is achieved through the use of the HttpRequestMessage -> Async<HttpResponseMessage> signature. Pushing the app calls in the MessageHandler intercepts all requests and allows you to take control at the earliest point possible before operation selection occurs. Extending this slightly to call the innerChannel's SendAsync would allow you to create a middleware layer that would work both with this and other, normal Web API services.

    39 people like this
    Posted: 1 years ago by Ryan Riley

  • A Clojure inspired (race free) memoize function

    A Clojure inspired (race free) memoize function, that uses a mutable atom cell.

    17 people like this
    Posted: 1 years ago by Nick Palladinos

  • F# googelsearch

    A google search automation.

    19 people like this
    Posted: 1 years ago by Chief Inspector Clouseau

  • Functional XML Construction and Query

    This snippet shows how to construct and query XML using XLinq without too many helper functions.

    17 people like this
    Posted: 1 years ago by Taha Hachana

  • Yahoo Historical Quote Implementation

    F# module to return historical EOD: open | high |low | close | volume quotes from Yahoo. Single day requests only. DataContract provided on the result record for easy serialization.

    10 people like this
    Posted: 1 years ago by akaPhenom

  • Web Crawler

    This snippet features an F# Web crawler that i'm already using in 2 applications (slightly modified). It's based on a scalable network of communicating agents that follow URLs extracted from HTML pages until reaching the specified limit.

    20 people like this
    Posted: 1 years ago by Taha Hachana

  • Asynchronous Controller Helper

    The snippet declares a helper for creating asynchronous controllers for ASP.NET MVC 3. It declares a new base class for asynchronous actions that exposes a computation builder for writing actions using F# asynchronous workflows.

    7 people like this
    Posted: 1 years ago by Tomas Petricek

  • WebSharper Hello World

    This sample implements "Hello, world!" as a WebSharper application. It demonstrates how to compose HTML/XML using combinators, how to dynamically create a button with a handler and how to update an existing DOM element.

    2 people like this
    Posted: 12 months ago by Tomas Petricek

  • Asynchronous Workflow Controller

    The snippet overrides default AsyncControllerActionInvoker so F# async workflows can be used for ASP.NET MVC 3. It declares a new base class for asynchronous controller. Controller method has to have return type Async<ActionResult>.

    3 people like this
    Posted: 11 months ago by Dmitry Morozov

  • Web Crawler extensions

    The snippet extends a web crawler from snippet http://fssnip.net/3K. It synchronizes all printing using an additional agent (so printed text does not interleave) and the crawling function returns an asynchronous workflow that returns when crawling completes.

    6 people like this
    Posted: 10 months ago by Tomas Petricek

  • AsyncSeq - Introduction and Crawler

    This snippet demonstrates programming using asynchronous sequences. It contains (hidden) implementation of AsyncSeq type and combinators for working with it. More importantly, it demonstrates how to use asynchronous sequences to implement a simple sequential on-demand crawler.

    8 people like this
    Posted: 9 months ago by Tomas Petricek

  • csproj-file parsing with Linq2Xml

    This program reads all *.csproj-files from a path and then uses Linq2Xml to show data about the projects. This should be a good template for scripts to manage tons of c#-project files. F# and LINQ-to-XML is very powerful combination.

    6 people like this
    Posted: 7 months ago by Tuomas Hietanen

  • JSON Parser

    JSON Parser using Regular Expressions & Active Patterns (just for fun).

    5 people like this
    Posted: 7 months ago by Phillip Trelford

  • Simple JS Calculator

    Simple calculator application for adding numbers, compiles to JavaScript via Pit (v0.1) (http://pitfw.posterous.com). Run: http://trelford.com/PitCalculatorApp.htm

    3 people like this
    Posted: 6 months ago by Phillip Trelford

  • Times Table JS game

    Simple times table browser based game., compiles to JavaScript via Pit (v0.1) (http://pitfw.posterous.com). Run: http://trelford.com/SevenSixes.htm

    2 people like this
    Posted: 6 months ago by Phillip Trelford

  • Light XML DSL

    A light domain specific language for declaring xml in F# as code.

    4 people like this
    Posted: 5 months ago by Huw Simpson

  • Active pattern to extract HttpStatusCode from WebException

    A simple active pattern that allows you to match WebExceptions by HttpStatusCode. I find it useful for quick scripts where I only need WebClient and don't have to get involved with WebRequest etc.

    5 people like this
    Posted: 5 months ago by Leaf Garland

  • Send HTTP POST request

    The snippet shows how to send HTTP POST request to a web page and download the generated HTML result. The POST data is encoded as a byte array and written to the request stream of HttpWebRequest.

    2 people like this
    Posted: 3 months ago by Tomas Petricek

  • StackOverflowCrawler

    Tries to find the best technologies from stackoverflow. Don't use too wide tags (with many thousand request) or firewall will block you!

    2 people like this
    Posted: 3 months ago by

  • Stackoverflow API script

    A script that consumes the Stackoverflow API in a dynamic fashion

    5 people like this
    Posted: 3 months ago by Mauricio Scheffer

  • csproj-file parsing with Linq2Xml - part 2

    This program reads all *.csproj-files from a path and then uses Linq2Xml to show or modify data about the projects. This should be a good template for scripts to manage tons of c#-project files. F# and LINQ-to-XML is very powerful combination.

    7 people like this
    Posted: 2 months ago by Tuomas Hietanen

  • Lazy Xml

    A Lazy Xml structure for processing large xml documents.

    6 people like this
    Posted: 1 months ago by Nick Palladinos

  • Lightweight syntax for creating JSon objects using Newtonsoft's Json.Net

    There's an easy way to create JSon objects using Newtonsoft's Json.Net. The common problem with Json.Net is that there's usualy a lot of overhead when creating Json with it as there're a lot of 'new', parentheses, nested objects when we don't need them. And it becomes annoying quite fast. DU Json and toJson function allow to create Json tree and convert it to Json.Net JObject hierarchy. On the examples the usage of lightweight syntax doesn't give a lot of win but it will be more clearer when it come to more complicated objects.

    4 people like this
    Posted: 1 months ago by Dmitry Lobanov

  • HTML File Type

    Discriminated unions to represent a HTML file.(not completely)

    2 people like this
    Posted: 1 months ago by Gab_km

  • Monadic transactions for Clojure-style atoms

    This is a simple implementation of a monadic transaction builder for Clojure-style atoms. Based on original code by Nick Palladinos.

    10 people like this
    Posted: 1 months ago by Eirik Tsarpalis

  • Speech Stackoverflow article automatically

    This snippet automatically speeches text of question,answers and comments in a Stackoverflow article. It requires HtmlAgilityPack(available from Nuget package manager).(Attention: You need reset F# interactive to stop the speech)

    5 people like this
    Posted: 7 days ago by nagat01