Skip to content

Instantly share code, notes, and snippets.

@mavnn
mavnn / build.fsx
Last active November 28, 2016 15:27
Literate build.fsx
(**
## References
As they aren't part of a project, fsx files need
to reference all of their dependencies within the
file.
You'll always want to reference FakeLib. VersionUpdater
is an inhouse tool we use for handling feature branch
@nicferrier
nicferrier / cps-foreach-bg.el
Created February 15, 2013 20:08
sentinel based cps in emacs-lisp. bit wierd
(defun cps-foreach-bg (proc l cont &optional command-args)
"Call PROC with each element of L, in the background.
When there are no more elements of L call CONT with L.
Optionally use the COMMAND-ARGS as the command to run in the
operating system to do the queueing."
(let* ((process-args (or command-args '("sleep" "1")))
(qproc (apply
'start-process
@PaulStovell
PaulStovell / gist:4983109
Created February 19, 2013 04:28
A LocalPackageRepository for NuGet that continues to work when packages are being written to it
/// <summary>
/// The local package repository (used for reading packages from the file system) is broken in NuGet.Core because
/// when a package is being written, it refuses to read the packages. This implementation wraps it by ignoring packages
/// that can't be written (either because they are locked or only partially written).
/// </summary>
public class FastLocalPackageRepository : LocalPackageRepository
{
readonly ILog log;
public FastLocalPackageRepository(string physicalPath, ILog log)
@pasberth
pasberth / AuthorizeOntoTwitterWithConduit.hs
Created March 3, 2013 03:19
Conduit で Twitter に認証するサンプル
import Web.Authenticate.OAuth as OAuth
import Data.Conduit
import Network.HTTP.Conduit
import qualified Data.ByteString as BS
import System.IO(hFlush, stdout)
oauth :: OAuth.OAuth
oauth = OAuth.newOAuth
{ OAuth.oauthServerName = "twitter"
, OAuth.oauthRequestUri = "https://twitter.com/oauth/request_token"
@filipw
filipw / gist:5087814
Created March 5, 2013 03:40
Get relevant assemblies with Nuget.Core
public IEnumerable<string> GetAssemblyNames(List<string> packageids, string version)
{
var packageDir = _fileSystem.CurrentDirectory + @"\" + "packages";
if (!Directory.Exists(packageDir))
return Enumerable.Empty<string>();
var items = new List<string>();
var repository = new LocalPackageRepository(packageDir);
@stirno
stirno / FluentAutomation.csx
Last active December 14, 2016 13:36
FluentAutomation test running in scriptcs (tested againt dev branch)
using FluentAutomation;
using FluentAutomation.Interfaces;
using System;
using System.IO;
using System.Reflection;
private static INativeActionSyntaxProvider I = null;
public static void Bootstrap<T>(string browserName)
{
@johnfredcee
johnfredcee / dotemacs.el
Created March 24, 2013 16:11
Emacs Init for Samsung Laptop
;; generic Emacs utility
;;; ------------------------------------------------------------------
(defun add-subdirs-to-load-path (dir)
(let ((default-directory (concat dir "/")))
(normal-top-level-add-subdirs-to-load-path)))
;;; basic load-path setup
;;; ------------------------------------------------------------------
@jroesch
jroesch / GADTs.scala
Created May 25, 2013 21:54
Scala GADTs
/* http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#gadt
Generalized Algebraic Datatypes in Scala */
trait Term[A]
case class Lit(x: Int) extends Term[Int]
case class Succ(x: Term[Int]) extends Term[Int]
case class IsZero(x: Term[Int]) extends Term[Boolean]
case class If[A](guard: Term[Boolean], t: Term[A], y: Term[A]) extends Term[A]
case class Pair[A, B](x: Term[A], y: Term[B]) extends Term[(A,B)]
@bhameyie
bhameyie / gist:5666748
Created May 28, 2013 22:48
Nuget with albacore
def readVersion(filepath="AssemblyInfo.cs")
File.open(filepath).each_line{ |line|
if line.start_with?("[assembly: AssemblyVersion(\"")
return line.gsub("[assembly: AssemblyVersion(\"", "").gsub("\")]","").gsub(/\s+/, "")
end
}
end
@swlaschin
swlaschin / type-dependency-graph.fsx
Last active February 27, 2025 07:40
This script analyzes the dependencies between top level types in a .NET Assembly. It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
(*
This script analyzes the dependencies between top level types in a .NET Assembly.
It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
Note that no attempt has been made to optimize the code yet!
REQUIRES:
* Mono.Cecil for code analysis
From http://www.mono-project.com/Cecil#Download