Skip to content

Instantly share code, notes, and snippets.

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
> 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",
<?php
namespace Embed\Sample\Resource\App;
use Bear\Resource\ResourceObject;
use Bear\Resource\FactoryInterface;
use Bear\Resource\AbstractUri;
class PeriodCollection extends ResourceObject {
/**
@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
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 / http_api.md
Created March 7, 2016 05:04
InfluxdbのHTTP APIをPoweshellから叩く例

Enter file contents here## create database

@{ q = "create database mydb" } | Invoke-WebRequest -Method Get -Uri "http://localhost:8086/query"

write data

write single data

@ritalin
ritalin / StartProcessEx.Example.ps1
Last active March 10, 2016 08:11
Extended Start-Process Cmdlet
New-Process (Resolve-Path .\usr\bin\influxd.exe) "-config $(Resolve-Path .\etc\influxdb\influxdb.conf)" |
Enable-TextLog -RedirectStandardError access_log -Verbose |
Launch-Process
New-Process (Resolve-Path .\usr\bin\influxd.exe) "-config $(Resolve-Path .\etc\influxdb\influxdb.conf)" |
Enable-EventLog -RedirectStandardError Access -Verbose |
Launch-Process
@ritalin
ritalin / InvokeDcc-D7.ps1
Last active June 9, 2017 07:33
Commandline build script for delphi7
$root = "HKCU:\Software\Borland\Delphi\7.0"
$rootDir = (ls $root\.. -Include "7.0" -Recurse).GetValue("RootDir")
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
function Update-DccLib {
$reg = ls $root -Include "Environment Variables" -Recurse | select -First 1
$envVars = @{ '$(DELPHI)' = $rootDir }
$reg.Property | %{ $envVars.Add([string]::Format('$({0})',$_), $reg.Getvalue($_)) }
@ritalin
ritalin / ExcelBoulerplate.ps1
Last active November 18, 2016 06:42
A function boilerplate for Excel processing by powershell.
function BoilerplateFunction {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[IO.FileInfo[]]$files
)
begin {
$xls = New-Object -ComObject Excel.Application
$xls.Visible = $false
$xls.DisplayAlerts = $false
@ritalin
ritalin / wc.ps1
Last active February 16, 2017 05:29
与えられた文字列中に含まれる単語の個数を単語ごとにカウントする for Powershell
$s = "I have a pen. I have a apple. oh!! Apple pen! I have a pen. I have a pineapple. oh!! Pineapple pen! Apple pen. Pineapplepen. Pen pineapple apple pen."
$s -split(' ') | ?{ $_ -match "(\w+)[^.!]?" } | %{ $matches[1] } | group | select -Property Name,CountName   
# Name         Count
# ----         -----
# I                4
# have             4
# a                4
# pen              7
# apple            4