Skip to content

Instantly share code, notes, and snippets.

🕹
.

Felipe felipegtx

🕹
.
Block or report user

Report or block felipegtx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@felipegtx
felipegtx / get.java
Last active Aug 9, 2017
Iterator get by index
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(); } }
}
@felipegtx
felipegtx / singleton.cs
Last active Aug 29, 2015
C# singleton class
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); } }
@felipegtx
felipegtx / full.html
Last active Aug 29, 2015
Resposta desafio 2
View full.html
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<style>
table tr td
{
height: 2px;
}
@felipegtx
felipegtx / Desafio2.cs
Created Feb 25, 2014
Contador de bytes do Desafio 2
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",
@felipegtx
felipegtx / monads1.cs
Last active Aug 29, 2015
Monads in C#
View monads1.cs
public class Program
{
static Func<int> Identity(int x)
{
return () => x;
}
static Func<int, Func<int>> Multiply(Func<int> what)
{
@felipegtx
felipegtx / SimpleLocker.cs
Last active Dec 20, 2015
Lock manager for C# (wrapping a RWLSlim implementation)
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)
{
You can’t perform that action at this time.