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
"scripts": { | |
"start": "node app.js", | |
"package": "cross-zip ../src deployment.zip " | |
} |
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
// app.js (continues) | |
var server = http.createServer(async (req, res) => { | |
if (req.method === "GET") { | |
res.writeHead(200, "OK", { "Content-Type": "text/html" }); | |
const result = await try_connect_sql(process.env.CONNECTION_STRING); | |
res.write(result ? html_connected : html_disconnected); | |
} else { | |
res.writeHead(405, "Method Not Allowed", { "Content-Type": "text/plain" }); | |
} | |
res.end(); |
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
//app.js | |
const port = process.env.PORT || 3000, | |
sql = require("mssql"), | |
http = require("http"), | |
fs = require("fs"), | |
html_disconnected = fs.readFileSync("index_disconnected.html"), | |
html_connected = fs.readFileSync("index_connected.html"); | |
const try_connect_sql = async (connectionString) => { | |
try { |
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 * as aws from "@pulumi/aws"; | |
// Create an AWS resource (S3 Bucket) | |
const bucket = new aws.s3.Bucket("my-bucket-123"); | |
// Export the name of the bucket | |
export const bucketName = bucket.id; |
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 class SortOptionModelBinder : IModelBinder | |
{ | |
private string[] SEPERATOR = { " " }; | |
private readonly IEnumerable<string> Fields = new []{ "FirstName", "LastName", "Age" }; | |
public bool BindModel(`ttpActionContext actionContext, ModelBindingContext bindingContext) | |
{ | |
if (bindingContext.ModelType != typeof(SortOption)) | |
{ | |
return false; |
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 class SortOptionModelBinderTest | |
{ | |
private HttpActionContext _context; | |
private ModelBindingContext _bindingContext; | |
private SortOptionModelBinder _binder; | |
private IValueProvider _valueProvider; | |
public SortOptionModelBinderTest() | |
{ | |
_context = Substitute.For<HttpActionContext>(); |
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
namespace SampleWebapi | |
{ | |
internal class SignAttribute : Attribute | |
{ | |
public string Name { get; set; } | |
public SignAttribute(string name) | |
{ | |
Name = name; | |
} | |
} |
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
[alias] | |
co = checkout | |
ec = config --global -e | |
up = !git pull --rebase --prune $@ && git submodule update --init --recursive | |
cob = checkout -b | |
cm = !git add -A && git commit -m | |
save = !git add -A && git commit -m 'SAVEPOINT' | |
wip = !git add -u && git commit -m "WIP" | |
undo = reset HEAD~1 --mixed | |
amend = commit -a --amend |
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 System; | |
using System.ComponentModel.DataAnnotations; | |
using System.ComponentModel.DataAnnotations.Schema; | |
using System.Configuration; | |
using System.Data.Entity; | |
using System.Data.SqlClient; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; |
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
.Lambda #Lambda1<System.Func`2[AutomapperQuesriableTest.Destination,System.Boolean]>(AutomapperQuesriableTest.Destination $dto) | |
{ | |
(.New AutomapperQuesriableTest.Source(){ | |
FullName = $dto.Name, | |
NumberOfYears = $dto.Age | |
}).FullName == "ahmadreza" && (.New AutomapperQuesriableTest.Source(){ | |
FullName = $dto.Name, | |
NumberOfYears = $dto.Age | |
}).NumberOfYears > 10 | |
} |