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
/* | |
* http://johan.heapsource.com | |
*/ | |
import std.stdio; | |
import std.json; | |
void main() { | |
JSONValue v = parseJSON(q{ | |
{"a":2, "b":{"c":20}} |
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
/* | |
* http://johan.heapsource.com | |
*/ | |
import std.stdio; | |
import std.json; | |
JSONValue doc; | |
void main() { |
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
using Microsoft.WindowsAzure.ServiceRuntime; // Microsoft.WindowsAzure.ServiceRuntime.dll | |
... | |
if (RoleEnvironment.IsAvailable) { | |
// running inside Azure Fabric | |
if(RoleEnvironment.IsEmulated) { | |
// Fabric is running in Emulator |
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
// | |
// http://blog.heapsource.com/post/71111508527/events-d | |
// | |
import std.stdio; | |
import std.string; | |
import events; | |
void main() { | |
auto event = new EventList!(string, int); |
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
// | |
// http-parser.d example | |
// http://blog.heapsource.com/post/70495154255/announcing-http-parser-d | |
// | |
import std.stdio; | |
import http.parser.core; | |
void main() { | |
"http-parser.d in action with fixed-size Http Message Body".writeln; |
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
import std.stdio; | |
import std.algorithm; | |
import std.string; | |
// event list declared with string return value, first parameter as string and second parameters as int. | |
static EventList!(string, string, int) formatter; | |
// event list declared with no parameters and returning void. | |
static EventList!void voidEvents; |
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
import std.stdio; | |
import std.algorithm; | |
import std.string; | |
// event list declared with string return value, first parameter as string and second parameters as int. | |
static EventList!(string, string, int) formatter; | |
// event list declared with no parameters and returning void. | |
static EventList!void voidEvents; |
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
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
default_type application/octet-stream; | |
keepalive_timeout 65; | |
server { |
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
Duv takes the delegated passed to runMainDuv and wraps in a Fiber so we can suspend the execution while we wait for libuv. | |
here: | |
https://github.com/heapsource/duv/blob/master/src/duv/core.d#L159 | |
Loops starts here, we block the execution of the app until the main fiber finishes: | |
https://github.com/heapsource/duv/blob/master/src/duv/core.d#L141 | |
Example stream read: |
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
typedef NS_ENUM(NSInteger, UITableViewCellStyle) { | |
UITableViewCellStyleDefault, // Simple cell with text label and optional image view (behavior of UITableViewCell in iPhoneOS 2.x) | |
UITableViewCellStyleValue1, // Left aligned label on left and right aligned label on right with blue text (Used in Settings) | |
UITableViewCellStyleValue2, // Right aligned label on left with blue text and left aligned label on right (Used in Phone/Contacts) | |
UITableViewCellStyleSubtitle // Left aligned label on top and left aligned label on bottom with gray text (Used in iPod). | |
}; // available in iPhone OS 3.0 |