Skip to content

Instantly share code, notes, and snippets.

function LoadAssembly {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[string[]]$asmNames,
[string]$baseDir = $PSScriptRoot
)
begin {
$domain = [System.AppDomain]::CurrentDomain
[Reflection.Assembly[]]$asms = $domain.GetAssemblies()
@ritalin
ritalin / FsFormatProto.fs
Last active August 29, 2015 14:23
Excercising F# Formatting Prototype from F# Deep Dives
type MarkdownDocument = MarkdownBlock list
and MarkdownBlock =
| Heading of int * MarkdownSpans
| Paragraph of MarkdownSpans
| CodeBlock of string list
| BlockQuote of MarkdownBlock list
and MarkdownSpans = MarkdownSpan list
<?php
namespace Embed\Sample\Resource\App;
use Bear\Resource\ResourceObject;
use Bear\Resource\FactoryInterface;
use Bear\Resource\AbstractUri;
class PeriodCollection extends ResourceObject {
/**
> php .\bootstrap\api.php get "/weekday/2015/5/5"
200 OK
content-type: application/hal+json
{
"weekday": "Tue",
"action": "/weekday",
"year": "2015",
"month": "5",
"day": "5",
object TLayout
StyleName = 'toggleButtonstyle'
DesignVisible = False
Height = 24.000000000000000000
Position.X = 478.000000000000000000
Position.Y = 354.000000000000000000
Width = 91.000000000000000000
object TRectangle
StyleName = 'background'
Align = alContents
<?xml version="1.0" ?>
<configuration>
<appSettings>
<add key="AAA">
<sets>
<add key="AAA_1" value="値1" />
<add key="AAA_2" value="値2" />
<add key="AAA_3" value="値3" />
</sets>
</add>
function test(){
get-pscallstack | select -skip 1 -first 1 | %{
if ([io.path]::GetExtension($_.ScriptName) -eq ".psm1") {
if (test-path "$($_.ScriptName).config") {
[xml](Get-Content "$($_.ScriptName).config")
}
elseif (test-path "$($_.ScriptName).json") {
[string]::join('', (Get-Content "$($_.ScriptName).json")) | ConvertFrom-Json
}
else {
@ritalin
ritalin / protpcpl_sample.ex
Created September 2, 2014 14:27
型クラスっぽく見える何か by Elixir
defmodule Option do
defmodule None, do: defstruct []
defmodule Some, do: defstruct [:value]
def none(), do: %None{}
def some(x), do: %Some{ value: x }
end
defprotocol FunctorSpec do
@type t :: term
@ritalin
ritalin / ComponentStream.pas
Last active August 29, 2015 14:03
A support class for cloning component.
unit Sample;
interface
uses
SysUtils, Classes, FMX.Controls;
type
// 名前決定するためのイベント
[o][230]Command aliases not defined when hosting
[c][229]Bitwise operators -band, -bor and -bxor
[o][228]Invalid expression stops all further processing of input
[c][227]Implement subexpression operator $(...)
[c][226]CSV cmdlets support; Escape character support
[o][225]Single quoted string doesn't allow escaped single quotes
[c][224]Get-Member fix; Introduction of Select-Object cmdlet; Refactoring
[c][223]Split-Path cmdlet
[c][222]Environment provider
[o][221]SessionStateProxy.GetVariable should return the actual object for value types