These are my solutions for the proposed exercises on the Tour of Go Website ( https://tour.golang.org/ )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function and<T>(conditions : Array<(T) => boolean>) : (obj:T) => boolean { | |
return (e: T) => conditions.every( c=> c(e)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Main from "./main"; | |
import {Program} from "./program"; | |
Main.bootstrap(Program); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
builder.Register<SingleInstanceFactory>(ctx => | |
{ | |
var c = ctx.Resolve<IComponentContext>(); | |
return t => | |
{ | |
object o; | |
return c.TryResolve(t, out o) ? o : null; | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AsyncMethodBuilder(typeof(AsyncCustomValueTaskMethodBuilder<>))] | |
[StructLayout(LayoutKind.Auto)] | |
public struct CustomValueTask<T>: IEquatable<CustomValueTask<T>> | |
{ | |
internal readonly T _result; | |
internal readonly Task<T> _task; | |
public CustomValueTask(Task<T> task) | |
{ | |
_task = task; | |
_result = default(T); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chalk = require('chalk'); | |
const glob = require('glob'); | |
const sloc = require('sloc'); | |
const fs = require('fs'); | |
let pattern = "**"; | |
let jsExcludes = ['**/app.bundle.*', '**/node_modules/**', '**/lib/**']; | |
let slocKeys = ['total', 'comment', 'todo', 'source']; | |
let extension = process.argv.slice(2)[0]; | |
let targetExtension = `*.${extension}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.EntityFrameworkCore; | |
namespace Microsoft.EntityFramework.Conventions.Extensions | |
{ | |
public class Context : DbContext | |
{ | |
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
modelBuilder.SetGlobalMaxLength(200); | |
modelBuilder.SetGlobalTablePrefix("tbl_"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<T1> ReadWithMap<T1, T2, TReturn>(Func<T1, object> key, Func<T1, string> targetMap) where TReturn : T1 | |
{ | |
var lookup = new Dictionary<object, T1>(); | |
var targetType = typeof(T1); | |
var propertyFlags = BindingFlags.Public | BindingFlags.Instance; | |
gridReader.Read<T1, T2, T1>((t1, t2) => | |
{ | |
if (!lookup.TryGetValue(key(t1), out T1 t1Return)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Identity; | |
using Microsoft.AspNetCore.Server.HttpSys; | |
namespace Api | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am carloslanderas on github. | |
* I am lande (https://keybase.io/lande) on keybase. | |
* I have a public key ASCj0FTIhQAEKSYMC1JhWLe9e49ZvmsL56xmvKissiQXaAo | |
To claim this, I am signing this object: |
OlderNewer