Skip to content

Instantly share code, notes, and snippets.

@ppetr
ppetr / CloseExample.scala
Created June 21, 2013 14:13
An example of using scala-conduit for reading a file util a given character is found. See https://github.com/ppetr/scala-conduit
import java.nio._
import java.nio.channels.Channels
import java.io.{ FileInputStream, IOException }
import java.util.zip._
import scala.util.control.Exception._
import conduit._
import conduit.Pipe._
object CloseExample extends App {
/**
@hidsh
hidsh / dired-open-mac.el
Last active November 9, 2016 15:48
Dired からファイルを Mac の quicklook or openコマンド で開く
(defun open-mac (path)
(start-process "dired-open-mac" nil "open" path))
(defun quicklook-file (path)
(interactive)
(defvar cur nil)
(defvar old nil)
(setq old cur)
(setq cur (start-process "ql-file" nil "qlmanage" "-p" path))
(when old (delete-process old)))
@joastbg
joastbg / gist:6280065
Created August 20, 2013 11:01
F# project file (fsproj)
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{a9120397-fd09-4e7f-9384-c7fd8976acc5}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ApplicativeFParsec</RootNamespace>
@pseudomuto
pseudomuto / Feature.cs
Last active March 16, 2017 17:20
Blog Code: Continuous Integration for .NET with Travis and xUnit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CI.Demo
{
public class Feature
{
public string Name { get; private set; }
@mavnn
mavnn / csharp.cs
Created September 24, 2013 13:17
C# and F# comparisons of NuGet ProjectSystem implementations. F# code is from https://github.com/mavnn/NuGetPlus/blob/master/NuGetPlus.Core/ProjectSystem.fs C# code is from http://nuget.codeplex.com/SourceControl/latest#src/CommandLine/Common/MSBuildProjectSystem.cs They aren't identical in functionality, but they're pretty similar and implement…
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Versioning;
using Microsoft.Build.Evaluation;
namespace NuGet.Common
{
@denen99
denen99 / gist:6765084
Created September 30, 2013 15:01
Coursera week 2 scala tests
package funsets
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
/**
* This class is a test suite for the methods in object FunSets. To run
* the test suite, you can either:
;; This is a bad idea.
(defun restart-process (process)
(let ((name (process-name process))
(buffer (process-buffer process))
(program-and-args (process-command process))
(sentinel (process-sentinel process))
(filter (process-filter process))
(new-process))
(with-current-buffer buffer
@XSockets
XSockets / AssemblyRuntimeRecomposition.cs
Last active December 19, 2016 20:49
Rutime recomposition - The XSockets pluginframework can now load assemblies at runtime.
public class Zoo : IZoo
{
public IList<IAnimal> Animals { get; set; }
}
public class Frog : IAnimal
{
public string Say()
{
return "Riiiibbitt";
@danchoi
danchoi / mso.hs
Created October 25, 2013 16:29
Draft HXT Haskell code to turn Microsoft exported HTML into nested HTML lists
{-# LANGUAGE Arrows, NoMonomorphismRestriction #-}
module Main where
import Text.XML.HXT.Core
import System.Environment
import Data.List
import Control.Arrow.ArrowNavigatableTree
import Text.XML.HXT.XPath.Arrows
import Data.Tree.NTree.TypeDefs
import Data.Tree.NavigatableTree.Class
@chpatrick
chpatrick / gist:7358782
Last active October 26, 2016 19:15
Haskell checked exceptions
{-# LANGUAGE TypeFamilies, KindSignatures, DataKinds, TypeOperators, GADTs, MultiParamTypeClasses, FlexibleInstances, GeneralizedNewtypeDeriving, OverlappingInstances, ScopedTypeVariables, FlexibleContexts #-}
import Control.Applicative
import Control.DeepSeq
import qualified Control.Exception as E
-- Closed type family, needs GHC HEAD.
type family Minus (e :: *) (es :: [*]) :: [*] where
Minus e '[] = '[]
Minus e (e ': es) = Minus e es