Skip to content

Instantly share code, notes, and snippets.

View squadwuschel's full-sized avatar
💭
Working

SquadWuschel squadwuschel

💭
Working
  • Relaxdays
  • Germany
View GitHub Profile
@squadwuschel
squadwuschel / Layout.cshtml
Created August 27, 2016 21:34
React Hello World Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Meine ASP.NET-Anwendung</title>
@Styles.Render("~/Content/css")
</head>
<body>
@squadwuschel
squadwuschel / helloworldTypeScript.tsx
Created August 27, 2016 21:54
TypeScript TSX Datei für Hello World React Beispiel
/// <reference path="../typings/tsd.d.ts" />
// A '.tsx' file enables JSX support in the TypeScript compiler,
// for more information see the following page on the TypeScript wiki:
// https://github.com/Microsoft/TypeScript/wiki/JSX
var Counter = React.createClass({
add: () => {
console.log('add 1!');
},
@squadwuschel
squadwuschel / ProxyController.cs
Created October 22, 2016 17:46
.NET Controller für Angular 2 Proxygenerierung
using ProxyGenerator.ProxyTypeAttributes;
public class ProxyController : Controller
{
[CreateAngular2TsProxy(ReturnType = typeof(Person))]
public JsonResult AddTsEntryOnly(Person person)
{
return Json(person, JsonRequestBehavior.AllowGet);
}
@squadwuschel
squadwuschel / proxyService.ts
Created October 22, 2016 17:50
Automatisch erstellter Service für Angular 2 aus .NET Controller
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/observable';
import 'rxjs/add/operator/map';
@Injectable()
export class Proxyservice {
constructor(private http: Http) { }
@squadwuschel
squadwuschel / tsconfig.json
Last active February 28, 2017 08:21
Angular 2 "Hello World" tsconfig.json Einstellungen
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
@squadwuschel
squadwuschel / stringInterpolation.cs
Last active May 29, 2017 09:29
String Interpolation C# 6
for (int i = 0; i < 10; i++)
{
Console.WriteLine($"Der Aktuelle Index: {i}");
}
@squadwuschel
squadwuschel / nameof.cs
Created November 27, 2016 12:15
Nameof Beispiel
class Program
{
static void Main(string[] args)
{
var personNamePropertyName = nameof(Person.Name);
Console.WriteLine($"Der Name des Properties ist: {personNamePropertyName}");
}
}
public class Person
@squadwuschel
squadwuschel / person.cs
Created November 27, 2016 12:21
Property Initialisierung C# 6
public class Person
{
public string Name { get; set; } = string.Empty;
public string Vorname { get; set; } = string.Empty;
public int Alter { get; set; } = 21;
public List<string> Spitznamen { get; set; } = new List<string>();
public string Anzeigename => $"{Vorname}, {Name}";
}
@squadwuschel
squadwuschel / elvisopertator.cs
Created November 27, 2016 12:30
ElvisOperator beispiel
public string Searchnames(List<string> namen)
{
var result = string.Empty;
if (namen?.Count > 0)
{
//do somethig
}
return result;
}
@squadwuschel
squadwuschel / package.json
Created December 7, 2016 08:07
npm Scripts
{
"scripts": {
"start": "webpack-dev-server --inline --progress --port 8080"
},
"dependencies": {
"@angular/common": "~2.2.0",
"@angular/compiler": "~2.2.0",
...
}