Skip to content

Instantly share code, notes, and snippets.

@YuukiARIA
YuukiARIA / GCAllocTests.cs
Last active January 17, 2019 05:37
Unity GC Alloc Examples (Unity2018.3.0f2 PlayMode Test)
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine.TestTools.Constraints;
using Is = UnityEngine.TestTools.Constraints.Is;
enum Language
{
Ruby, CSharp, Elixir
module Peano
O = [].freeze
def succ(n)
n | [n]
end
def pred_rec(n, p, q)
if n == p
q
@YuukiARIA
YuukiARIA / lambda.rb
Created April 11, 2015 21:00
work in progress
module Church
Z = -> (s) { -> (z) { z } }
SUCC = -> (x) { -> (s) { -> (z) { s[x[s][z]] } } }
ADD = -> (x) { -> (y) { -> (s) { -> (z) { y[s][x[s][z]] } } } }
def value(x, succ: -> (n) { n + 1 }, unit: 0)
x[succ][unit]
end
end
package sandbox;
class First
{
public static Second setName(String name)
{
return new Second(name);
}
}
use strict;
use warnings;
use List::Util qw/sum reduce/;
use Test::More;
sub sample1 {
my ( $a, $b ) = @_;
if ( !$a && !$b ) {
@YuukiARIA
YuukiARIA / swap.java
Last active August 29, 2015 14:00
Java swap
public class Main
{
private static void swap(Integer a, Integer b) // Integer使って参照(共有)渡し
{
Integer t = a;
a = b;
b = t;
}
public static void main(String[] args)
@YuukiARIA
YuukiARIA / swap.cpp
Created April 18, 2014 08:59
C++ swap
#include <cstdio>
using namespace std;
void swap(int &a, int &b)
{
int t = a;
a = b;
b = t;
}
@YuukiARIA
YuukiARIA / list_link.cpp
Created December 30, 2013 19:37
list link
@YuukiARIA
YuukiARIA / gist:8185507
Created December 30, 2013 18:03
循環リスト
環状リストです。
+----+
| |
[0] |
| |
[1] |
| |
[2] |
@YuukiARIA
YuukiARIA / gist:6732424
Last active December 24, 2015 02:39
[neta] Chaos Java
// This is a well-compiled java class!
class A
{
A(A A) { } A
A(A A) { return new A(A); }
}