Skip to content

Instantly share code, notes, and snippets.

View marcioalthmann's full-sized avatar

Márcio Fábio Althmann marcioalthmann

View GitHub Profile
var livros = ["A Sociedade do Anel", "As Duas Torres", "O Retorno do Rei"]
for livro in livros{
println(livro);
}
@marcioalthmann
marcioalthmann / for-condition-increment.swift
Created September 5, 2014 02:19
for-condition-increment
for var i = 0; i < 10; ++i{
if(i % 2 == 0){
println(i);
}
}
@marcioalthmann
marcioalthmann / fileurl.cs
Created January 27, 2015 14:14
Extraindo o nome do arquivo a partir de uma URL
var uri = new Uri("http://www.seusite.com/arquivos/arquivo.jpg");
var nomeDoArquivo = string.Empty;
if(uri.IsFile)
nomeDoArquivo = Path.GetFileName(uri.LocalPath);
@marcioalthmann
marcioalthmann / c.sublime-build
Created June 23, 2015 23:17
Build system de C para o Sublime Text com output no Terminal do OSX
{
"cmd": ["gcc", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c",
"variants":
[
{
"name": "Run",
@marcioalthmann
marcioalthmann / app.config.xml
Last active August 29, 2015 14:24
Configuração BIT
<configuration>
<configSections>
<section name="Bit" type="Benner.Tecnologia.Business.Test.Bit, Benner.Tecnologia.Business.Test" />
</configSections>
<Bit>
<Profiles>
<Profile Name="Desenvolvimento"
Default="True"
SuperServerHost="Servidor"
@marcioalthmann
marcioalthmann / Testes.cs
Created July 7, 2015 12:08
Testes utilizando Profile no BIT
[BefTestClass(Profile = "Desenvolvimento")]
public class Desenvolvimento
{
[Test]
public void Test()
{
Assert.AreEqual("WES_DESENVOLVIMENTO", AppContext.Administration.DefaultSystemInstanceName);
}
}
@marcioalthmann
marcioalthmann / stringinterpolation.cs
Created July 27, 2015 23:39
Comparação string.format e string interpolation
var nome = "Márcio";
var idade = 31;
var stringFormat = string.Format("Nome: {0}, Idade: {1}", nome, idade);
var stringInterpolation = $"Nome: {nome}, Idade: {idade}";
@marcioalthmann
marcioalthmann / stringinterpolationtests.cs
Last active August 29, 2015 14:26
Testes string interpolation
[TestFixture ()]
public class StringInterpolationTests
{
[Test ()]
public void TestCase01 ()
{
var nome = "Márcio";
var idade = 31;
var resultadoExperado = "Nome: Márcio, Idade: 31";
@marcioalthmann
marcioalthmann / stringinterpolationil
Created July 27, 2015 23:54
IL string interpolation
.namespace csharpfeatures
{
.class private auto ansi beforefieldinit MainClass
extends [mscorlib]System.Object
{
// method line 1
.method public hidebysig specialname rtspecialname
instance default void '.ctor' () cil managed
{
@marcioalthmann
marcioalthmann / DadosBase.cs
Created February 6, 2011 17:13
Classe de acesso a dados, onde não existia EF e eu não usava NHibernate.
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.IO;
using System.Reflection;
using System.Web;