| let partition_by_identity = xs => { | |
| let rec impl = (xs, cur) => { | |
| switch (xs, cur) { | |
| | ([], _) => [cur] | |
| | ([x, ...xs], []) => impl(xs, [x]) | |
| | ([x, ...xs], [y, ..._]) => | |
| if (x == y) { | |
| impl(xs, [x, ...cur]); | |
| } else { | |
| [cur, ...impl(xs, [x])]; |
| (menhir | |
| (modules parser)) | |
| (ocamllex lexer) | |
| (executable | |
| (name ex)) |
| #=============================================================================== | |
| # Replace-Content: 特定パス配下の全てのファイル内の指定文字列を置換する | |
| # Param: | |
| # $filePath : ファイルパス | |
| # $replaceText1 : 置換対象文字列 | |
| # $replaceText2 : 置換後の文字列 | |
| # | |
| # 使用例 | |
| # #sample.txtのファイル内の"AAA"という文字列を"BBB"に置換する | |
| # Get-Content "C:\Work\*" "AAA" "BBB" |
| # | |
| # Usage : .\Merge-Image.ps1 .\test*.png .\mergeImages\ | |
| # | |
| $fileList = Get-ChildItem $args[0] | |
| for ($i = 0; $i -lt $fileList.count; $i = $i + 2) { | |
| # Add System.Drawing assembly | |
| Add-Type -AssemblyName System.Drawing | |
| $firstImage = [System.Drawing.Image]::FromFile((Get-Item $fileList[$i])) | |
| if (($i + 1) -lt $fileList.count) { |
| # | |
| # Usage : .\Invert-Image.ps1 .\test*.png | |
| # | |
| [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null | |
| Get-ChildItem $args[0] | ForEach-Object { | |
| $image = New-Object System.Drawing.Bitmap($_.fullname) | |
| for ($y = 0; $y -lt $image.Height; $y++) { | |
| for ($x = 0; $x -lt $image.Width; $x++) { | |
| $pixelColor = $image.GetPixel($x, $y) | |
| $varR = 255 - $pixelColor.R |
| SPC | |
| SPC: find file | |
| , switch buffer | |
| . browse files | |
| : MX | |
| ; EX | |
| < switch buffer | |
| ` eval | |
| u universal arg | |
| x pop up scratch |
"A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition..." Haskell Wiki, PhantomType
The following write-up is intended as an introduction into using phantom types in ReasonML.
Taking a look at the above definition from the Haskell wiki, it states that phantom types are parametrised types where not all parameters appear on the right-hand side. Let's try to see if we can implement a similar example as in said wiki.
Let's say the plugin is at a GitHub URL https://github.com/manasthakur/foo.
First get the plugin by either cloning it (git clone https://github.com/manasthakur.foo.git) or simply downloading it as a zip (from its GitHub page).
Adding a plugin in Vim is equivalent to adding the plugin's code properly into its runtimepath (includes the $HOME/.vim directory by default).
For example, if the layout of a plugin foo is as follows:
foo/autoload/foo.vim
foo/plugin/foo.vim