Skip to content

Instantly share code, notes, and snippets.

if (isBurning) {
worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, Blocks.tarKilnActive.id)
} else {
worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, Blocks.tarKiln.id)
}
@Mr-Byte
Mr-Byte / gist:4608614
Created January 23, 2013 15:58
C# 5: Works as one would reason. C# 4 and below: All eight planets are Neptune?! This is why C# 5 is the superior version.
using System;
using System.Collections.Generic;
namespace Test
{
class Program
{
static void Main(string[] args)
{
var planets = new[] {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"};
let internal unorderedOptList (ps : Parser<'a, 'u> list) =
fun (stream : CharStream<'u>) ->
let keys = [ 0 .. (ps |> List.length) - 1 ]
let parsers = ref (ps |> List.zip keys |> Map.ofList)
let results = keys |> List.map (fun key -> (key, ref (Reply(None)))) |> Map.ofList
let mutable continueLooping = true
let runParser (key : int) (value : Parser<'a, 'u>) =
let state = stream.State
let result : Reply<'a> = (value stream)
@Mr-Byte
Mr-Byte / linq.rs
Last active August 13, 2017 18:00
Proof of concept macro to implement LINQ syntax in rust.
macro_rules! query(
(from $v:ident in $c:ident $(where $mw:expr)* select $ms:expr) =>
($c.filter_mapped(|&$v| if(true $(&& $mw)*) { Some($ms) } else { None }))
)
fn main()
{
let nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let result1 = query!(from x in nums select x * 2);
struct Blorp
{
bar: ~int
}
impl Blorp
{
fn wrap(value: ~int) -> Blorp
{
Blorp { bar: value }
extern "C" fn foo()
{
println("Hello, world!");
}
struct Bar
{
Foo: extern "C" fn()
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Math;
public class Point(double x, double y)
{
public double X { get; } = x;
public double Y { get; } = y;
Imports AW
Module Bot
' Variable to hold a reference to the bot instance.
Dim _instance As Instance
' Variable to hold a reference to avatar add handler.
Dim _avatarAddHandler As InstanceEventHandler
Sub Main()
var xs = from y in ys
where y % 2 == 0
let x = y * 2 + 1
select y;
var someResult = builder.AppendLine("Hello, world!")
.AppendLine("This is a test!");
var xs = from y in ys
where y % 2 == 0
let x = y * 2 + 1
select y;
var someResult = builder.AppendLine("Hello, world!")
.AppendLine("This is a test!");