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
//========================================== | |
// Hypothetical fully self-contained getting-started example for Suave Web Server scripting | |
// | |
// This script fetches the Paket.exe component which is referenced later in the script. | |
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been | |
// downloaded by the user (by executing the first part of the script) the reference | |
// shows as resolved and can be used. | |
//------------------------------------------ |
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
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
namespace System | |
{ | |
public static class AssemblyResolver | |
{ | |
internal static void Hook(params string[] folders) | |
{ |
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
#I @"..\packages\" | |
#r @"FSharp.Data\lib\net40\FSharp.Data.dll" | |
#load @"FSPlot\FsPlotBootstrap.fsx" | |
#r @"Deedle\lib\net40\Deedle.dll" | |
do fsi.AddPrinter(fun (printer:Deedle.Internal.IFsiFormattable) -> "\n" + (printer.Format())) | |
open Deedle | |
open FSharp.Data | |
open System | |
type Twitter = CsvProvider< @"C:\Users\Isaac\Downloads\fsharp_2013-2014.csv"> |
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
from functools import partial | |
from collections import Iterable | |
def component(Component): | |
""" | |
{ | |
label = gtk.Label('label') | |
label.set_size_request(640, 480) | |
label.set_justify(gtk.JUSTIFY_FILL) | |
} => |
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
case class Reader[C, A](g: C => A) { | |
def apply(c: C) = g(c) | |
def map[B](f: A => B): Reader[C, B] = | |
(c:C) => f(g(c)) | |
def flatMap[B](f: A => Reader[C, B]): Reader[C, B] = | |
(c:C) => f(g(c))(c) | |
} | |
object Reader { | |
implicit def Reader[A,B](f: A => B): Reader[A,B] = Reader(f) |
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
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main where | |
import Network (listenOn, withSocketsDo, accept, PortID(..), Socket) | |
import Control.Concurrent (forkIO) | |
import Control.Exception (handle, IOException) | |
import Control.Monad (liftM) | |
import System.IO (hSetBuffering, hPutStr, hClose, hGetContents, BufferMode(..), Handle, readFile) | |
import Debug.Trace |
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
#r @"packages\Streams.0.2.5\lib\Streams.Core.dll" | |
open System | |
open System.IO | |
open System.Collections.Generic | |
open Nessos.Streams | |
// make Visual Studio use the script directory | |
Directory.SetCurrentDirectory(__SOURCE_DIRECTORY__) |
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
(defun a-function (option callback) | |
"Open the message with key." | |
(interactive) | |
(let* ((buffer (get-buffer-create "aprocessbuffer")) | |
(command (a-build-autocomple-command option)) | |
(proc (start-process "aproccess" buffer "ls" "-l" ))) | |
(set-process-sentinel proc (lambda (process signal) | |
(cond | |
((equal signal "finished\n") | |
(let ((output (with-current-buffer (process-buffer process) |
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
{-# LANGUAGE OverloadedStrings, DeriveGeneric #-} | |
import Data.Aeson ((.:), (.:?), decode, encode, FromJSON(..), ToJSON(..), Value(..)) | |
import Data.Aeson.Encode.Pretty | |
import qualified Data.ByteString.Lazy as BS (readFile, writeFile) | |
import Control.Applicative ((<$>), (<*>)) | |
import Control.Monad.IO.Class | |
import Control.Monad |
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
#I @"packages\Nuget.Core.2.8.3\lib\net40-Client" | |
#r "NuGet.Core.dll" | |
#r "System.Xml.Linq.dll" | |
let repository = | |
NuGet.PackageRepositoryFactory.Default.CreateRepository | |
"https://nuget.org/api/v2" | |
type NuGetStat = | |
{ Id: string; DownloadCount:int} |