Instantly share code, notes, and snippets.

View get.java
public Object get(Object arr, int index) {
var iteratorBase = arr.?class.?iterator.?instantiate();
var i = 0;
aweTryCast (iteratorBase as iterator to SeqIterator, SetIterator) {
iterator.init(arr);
while (iterator.step()) {
if (i++ >= index) {
return iterator.get;
View liña.java
/** Configura CET Source Copyright Notice (CETSC)
This file contains Configura CM source code and is part of the
Configura CET Development Platform (CETDEV). Configura CM
is a programming language created by Configura Sverige AB.
Configura, Configura CET and Configura CM are trademarks of
Configura Sverige AB. Configura Sverige AB owns Configura CET,
Configura CM, and CETDEV.
Copyright (C) 2004 Configura Sverige AB, All rights reserved.
View CaculatorTests.cs
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TDD.CalculatorImpl;
namespace TDD.UnityTests
{
[TestClass]
public class CaculatorTests
{
private ICalculator _calculator;
View InstanceResolver.cs
public abstract class InstanceResolverFor<SomeType>
{
public static Func<SomeType> InstanceBuilder = () =>
{
throw new Exception(string.Format("The type '{0}' does not have a valid factory.", typeof(SomeType).FullName));
};
public static SomeType Instance { get { return InstanceBuilder(); } }
}
View singleton.cs
/// SimpleLocker class avaliable at: https://gist.github.com/felipegtx/6107975
public sealed class SingletonFor<TheType>
{
private static Func<TheType> _instanceBuilder = null;
private Func<TheType> _constructorCall = null;
private SimpleLocker _locker = null;
private bool _isInitialized = false;
private TheType _instance;
public bool IsInitialized { get { return _locker.Read(() => _isInitialized); } }
View full.html
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<style>
table tr td
{
height: 2px;
}
View Desafio2.cs
using System;
using System.IO;
using System.Linq;
namespace Desafio2
{
class Program
{
private static string[] EXTENSIONS = new string[] {
".exe", ".log", ".pdb", ".js", ".html", ".htm",
View monads1.cs
public class Program
{
static Func<int> Identity(int x)
{
return () => x;
}
static Func<int, Func<int>> Multiply(Func<int> what)
{
View SimpleLocker.cs
using System;
using System.Threading;
namespace Threading
{
public sealed class SimpleLocker
{
private ReaderWriterLockSlim _locker = new ReaderWriterLockSlim();
private int _lockTimeout = 1000;
View YCombinator.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace YCombinatorCSharp
{
class Program
{
static void Main(string[] args)
{