Yet another rant about object-oriented programming, but mainly a collection of ideas stolen from functional programming to improve it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AsyncLazyPipeline<TSource> | |
{ | |
private Func<Task<TSource>> Expression { get; } | |
public AsyncLazyPipeline(Func<Task<TSource>> expression) | |
{ | |
Expression = expression; | |
} | |
public Task<TSource> Flatten() => Expression(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MaintenanceWindow { | |
[Bool]$Enabled = $true | |
[DateTime]$StartTime | |
[DateTime]$EndTime | |
[System.DayOfWeek[]]$DaysOfWeek = @([System.DayOfWeek]::Saturday, [System.DayOfWeek]::Sunday) | |
[ValidateSet('Weekly', 'Daily')][string]$Frequency | |
MaintenanceWindow ([DateTime]$StartTime, [DateTime]$EndTime, [String]$Frequency) { | |
$this.StartTime = $StartTime | |
$this.EndTime = $EndTime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static partial class LinqExtensions | |
{ | |
public static Maybe<C> SelectMany<A, B, C>(this Maybe<A> ma, Func<A, Maybe<B>> f, Func<A, B, C> select) => ma.Bind(a => f(a).Map(b => select(a, b))); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun call-process-on-buffer-to-string (command) | |
(with-output-to-string | |
(call-process-region (point-min) (point-max) shell-file-name nil standard-output nil shell-command-switch command))) | |
(defun flow-type () | |
(interactive) | |
(let* ((info (json-read-from-string | |
(call-process-on-buffer-to-string | |
(format "flow type-at-pos --json %d %d" (line-number-at-pos) (current-column))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Flycheck JSCS | |
(flycheck-def-config-file-var flycheck-jscs javascript-jscs ".jscs.json" | |
:safe #'stringp) | |
(flycheck-define-checker javascript-jscs | |
"A JavaScript code style checker. | |
See URL `https://github.com/mdevils/node-jscs'." | |
:command ("jscs" "--reporter" "checkstyle" | |
(config-file "--config" flycheck-jscs) | |
source) | |
:error-parser flycheck-parse-checkstyle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <mach/mach.h> | |
#include <mach/mach_vm.h> | |
#include <mach-o/dyld.h> | |
int | |
main (int argc, char * argv[]) | |
{ | |
volatile char * library; | |
const mach_vm_size_t page_size = getpagesize (); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
category | value | sector | |
---|---|---|---|
UK production emissions | 632 | UK | |
Carbon flows from EU | 88 | EU | |
Carbon flows to EU | -61 | EU | |
Carbon flows from other Annex 1 | 82 | Annex 1 | |
Carbon flows to other Annex 1 | -39 | Annex 1 | |
Carbon flows from non-Annex 1 | 104 | Other non-Annex 1 | |
Carbon flows from non-Annex 1 | 64 | China | |
Carbon flows to non-Annex 1 | -25 | Non-Annex 1 | |
UK consumption emissions | 845 | UK |
Download and install RyuJIT now.
RyuJIT only works on 64-bit editions of Windows Vista and Windows Server 2008 and later.
After installation, there are two ways to turn on RyuJIT. If you just want to enable RyuJIT for one application, set an environment variable:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem -Filter *.csproj -Recurse | | |
Select-Object -Property FullName,@{N="Xml"; E = { | |
Select-Xml -Path $_.FullName -XPath //b:Reference -Namespace @{b='http://schemas.microsoft.com/developer/msbuild/2003'} | | |
Select-Object -ExpandProperty Node | | |
Select-Object -Property Include, HintPath | | |
Where-Object { $_.HintPath -ne $null } | | |
Where-Object { $_.Include -eq "My.Assembly.Name" } | |
} } | | |
Where-Object { $_.Xml -ne $null } | | |
Out-GridView |
NewerOlder