Skip to content

Instantly share code, notes, and snippets.

View farukterzioglu's full-sized avatar
🎯
Focusing

Faruk Terzioğlu farukterzioglu

🎯
Focusing
View GitHub Profile
@farukterzioglu
farukterzioglu / ajax
Last active July 3, 2017 10:56
Set $ ajax to send cookies
$.ajaxSetup({
xhrFields: {
withCredentials: true // This setting passes cookies along the request, including our authentication cookie.
}
});
@farukterzioglu
farukterzioglu / CRTP.cs
Created June 30, 2017 08:32
Curiously Recurring Template Pattern (CRTP), (Generic, TDD, Fixture, SUT)
//Curiously Recurring Template Pattern (CRTP)
//http://zpbappi.com/curiously-recurring-template-pattern-in-csharp/
public interface IFixture<out TFixture, out TSut>
where TFixture : IFixture<TFixture, TSut>
where TSut : class
{
TFixture Setup();
TSut CreateSut();
}
using System;
using System.Runtime.CompilerServices;
using Xunit;
namespace Tests
{
public class Dto1{}
public class Dto2{}
public interface IDbModel
@farukterzioglu
farukterzioglu / ReturnCalculatedValue.cs
Created July 3, 2017 12:03
Mocking a method with calculated return value, instead of static return value. (Moq, TDD)
namespace MoqNotes
{
public interface ISubjectUnderTest
{
int GetData(int param);
}
public class Tests
{
[Fact]
@farukterzioglu
farukterzioglu / call-then-sendtx-pattern.js
Created June 28, 2018 17:19 — forked from ethers/call-then-sendtx-pattern.js
call-then-sendtx pattern for Ethereum Dapps
/*
In Ethereum, a contract can be written so that it returns a value for eth_call.
A Dapp can then check for success or error value of eth_call, before calling eth_sendTransaction,
to take advantage of eth_call effectively being a "preview" of the code flow that the transaction
will take. In traditional client-server, clients can't ask servers beforehand what's going to
happen when the client makes a call; with Dapps contracts can be written so that clients can ask
for a "preview" of what is going to happen, before any funds/ethers are actually utilized
(eth_call does not cost any ethers).
Note: it is possible that in between eth_call and when eth_sendTransaction is actually mined,
@farukterzioglu
farukterzioglu / install-rabbitmq.sh
Created August 17, 2018 13:57 — forked from yetanotherchris/install-rabbitmq.sh
RabbitMQ on Docker with admin UI
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
docker run -p 5000:80 -e CORE_ENVIRONMENT=prod similarityapi
docker run -p 5000:80 -e NETCORE_ENVIRONMENT=test similarityapi
https://git.hepsiburada.com/Hermes/product-similarity-finder.git
//dotnet docker file örnekleri
https://github.com/dotnet/dotnet-docker/tree/master/samples/dotnetapp
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=mybinary
BINARY_UNIX=$(BINARY_NAME)_unix
@farukterzioglu
farukterzioglu / btcd_pull_request_management.md
Created September 20, 2018 19:43 — forked from davecgh/btcd_pull_request_management.md
Managing a btcd Pull Request for Code Contibutions

Initial Preparation

The first step is to read the Code Contribution Guidelines documentation to get a good understanding of policies used by the project

Once that is done, the following commands illustrate a straight forward setup for submitting pull requests to the project:

One time setup

  • Fork btcd on github
  • Run the following command to obtain btcd, all dependencies, and install it (this has probably already been done):