Skip to content

Instantly share code, notes, and snippets.

{
"version": "0.1.0",
"command": "cargo",
"isShellCommand": true,
"tasks": [
{
"taskName": "build",
"isBuildCommand": true,
"showOutput": "always",
"problemMatcher": {
use std::ffi::OsString;
use std::os::windows::ffi::OsStrExt;
#[link(name = "user32")]
extern "stdcall" {
fn MessageBoxW(hwnd: *mut (), message: *const u16, title: *const u16, kind: u32);
}
struct LPCWSTR {
str: Vec<u16>
@Mr-Byte
Mr-Byte / linq.rs
Last active August 29, 2015 14:18
macro_rules! query {
($($tokens:tt)*) => {
query_from!($($tokens)*)
};
}
macro_rules! query_from {
(from $context:pat => $source:expr, $($remainder:tt)+) => {
query_from!($source, $context => $($remainder)+)
};
macro_rules! update {
($source:ident with { $($field:ident: $newValue:expr),* }) => {
{
let mut result = $source.clone();
$(
result.$field = $newValue;
)*
result
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Detect whether or not to include debug symbols in the shader build. -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<ShaderDebugSymbols>false</ShaderDebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<ShaderDebugSymbols>true</ShaderDebugSymbols>
</PropertyGroup>
using Microsoft.FSharp.Core;
using System;
using System.IO;
using System.Runtime.CompilerServices;
[CompilationMapping(SourceConstructFlags.Module)]
public static class Program
{
[SpecialName]
public static FSharpChoice<Unit, Unit> \u007CEven\u007COdd\u007C(int n)
#![feature(macro_rules)]
macro_rules! active_match {
//Single zero parameter case
($m:expr, $i:ident() => $b:block) => {
match $i($m) {
Some(()) => $b,
_ => panic!("Encountered an unmatched active case.")
}
};
#![feature(macro_rules)]
macro_rules! active_match {
//Zero parameter case followed by one or more cases
($m:expr, $i:ident() => $b:block $(, $i_rest:ident($($ps_rest:pat),*) => $b_rest:block)+) => {
match $i($m) {
Some(()) => $b,
None => active_match! { $m, $($i_rest($($ps_rest),*) => $b_rest),+ }
}
};
Imports AW
Module GreeterBot
Dim Instance As IInstance
Sub Main()
Instance = New Instance()
AddHandler Instance.EventAvatarAdd, AddressOf OnAvatarEnter
using System;
namespace Option
{
public abstract class Option
{
public static Option Wrap<T>(T value)
where T : class
{
if(ReferenceEquals(value, null))