Snippets created by Taha Hachana
Sequence Random Permutation
A generic function that randomly permutes the elements of a sequence.
29 people like this
Posted: 1 years ago by Taha HachanaSetting 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 HachanaRegex Match Index
A function for interpreting the zero-based index property of a successful regular expression match in terms of line and column numbers.
15 people like this
Posted: 1 years ago by Taha HachanaCalculating Age
This function interprets a time span in terms of years, months and days.
23 people like this
Posted: 1 years ago by Taha Hachana
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 HachanaFunctional 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 HachanaWeb 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 HachanaRandom Subset
A function that takes a random subset from a seq<'T>.
0 people like this
Posted: 5 months ago by Taha Hachana