public static class AsyncEnumerableExtensions | |
{ | |
public static IAsyncEnumerable<TResult> SelectAsync<T, TResult>(this IEnumerable<T> enumerable, | |
Func<T, Task<TResult>> selector) | |
{ | |
return AsyncEnumerable.CreateEnumerable(() => | |
{ | |
var enumerator = enumerable.GetEnumerator(); | |
var current = default(TResult); |
diff --git a/JSONInputStream.java b/JSONInputStream.java | |
new file mode 100644 | |
index 0000000..93708ff | |
--- /dev/null | |
+++ b/JSONInputStream.java | |
@@ -0,0 +1,75 @@ | |
+package org.json; | |
+ | |
+import java.io.ByteArrayInputStream; | |
+import java.io.ByteArrayOutputStream; |
We've already looked at two different indexed monads in our tour so far, so let's go for a third whose regular counterpart isn't as well known: the privilege monad.
The regular privilege monad allows you to express constraints on which operations a given component is allowed to perform. This lets the developers of seperate interacting components be statically assured that other components can't access their private state, and it gives you a compile-time guarantee that any code that doesn't have appropriate permissions cannot do things that would require those permissions. Unfortunately, you cannot easily, and sometimes cannot at all, build code in the privilege monad that gains or loses permissions as the code runs; in other words, you cannot (in general) raise or lower your own privilege level, not even when it really should be a
Have you ever had to write code that made a complex series of succesive modifications to a single piece of mutable state? (Almost certainly yes.)
Did you ever wish you could make the compiler tell you if a particular operation on the state was illegal at a given point in the modifications? (If you're a fan of static typing, probably yes.)
If that's the case, the indexed state monad can help!
Motivation
$find = 'jquery-1\.4\.4' | |
$replace = 'jquery-1\.5\.1' | |
$match = '*.cshtml' , '*.vbhtml' | |
$preview = $true | |
foreach ($sc in dir -recurse -include $match | where { test-path $_.fullname -pathtype leaf} ) { | |
select-string -path $sc -pattern $find | |
if (!$preview) { | |
(get-content $sc) | foreach-object { $_ -replace $find, $replace } | set-content $sc | |
} |
- Related Setup: https://gist.github.com/hofmannsven/6814278
- Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
- Interactive Beginners Tutorial: http://try.github.io/
- Git Cheatsheet by GitHub: https://services.github.com/on-demand/downloads/github-git-cheat-sheet/
0x00 0 STOP | |
0x01 3 ADD | |
0x02 5 MUL | |
0x03 3 SUB | |
0x04 5 DIV | |
0x05 5 SDIV | |
0x06 5 MOD | |
0x07 5 SMOD | |
0x08 8 ADDMOD | |
0x09 8 MULMOD |