Skip to content

Instantly share code, notes, and snippets.

View marzoukali's full-sized avatar
:octocat:
Coding

Ahmed Ali marzoukali

:octocat:
Coding
  • Dublin, Ireland
View GitHub Profile
@marzoukali
marzoukali / gist:939c2978b0266906069e3c06c50a51a7
Created May 6, 2016 23:31 — forked from mikestone14/gist:11198630
Getting a GoDaddy domain to point to a Heroku app.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Unit Test</Title>
<Author>Rusty Divine</Author>
<Description>Unit Test Template with 3 Parts</Description>
<HelpUrl>https://msdn.microsoft.com/en-us/library/ms165394.aspx</HelpUrl>
<SnippetTypes />
<Keywords />
int divisionCount = 0;
for(int i =1; i<=100;++i)
 {
 if(i % 4 == 0)divisionCount++;
 else if(i % 6 == 0 && i % 10 == 0) divisionCount++;
}
cout << divisionCount; // 27
@marzoukali
marzoukali / gist:ad19c6b7df8b17456e5989a81b30bfcc
Created May 29, 2017 15:24
C++ Simple Problems - Problem 2 - First Trial
// First Trial:
int count = 0;
for(int x =1; x<=100;++x)
 {
 for(int y = 70; y<=200; y++)
 {
 if(x<y && (x+y) % 7 == 0) count++;
 }
}
cout << count;
@marzoukali
marzoukali / cpp-simple-problems-second
Created May 29, 2017 15:26
C++ Simple Problems - Problem 2 - Second Trial
int count = 0;
for(int x =1; x<=100;++x)
 {
 int y = 70
 
 if(x > y) y = x + 1; // If X already bigger than start of Y so skip all the small Y and move to y = x + 1; to enhance performance.
 
 for(; y<=200; y++)
 {
 if((x+y) % 7 == 0) count++;
@marzoukali
marzoukali / gist:648b2e2fbf49e72eceb58755d3499bb3
Created May 29, 2017 15:27
c++ - Simple Problems - Second Problem - Third Trial
int count = 0;
for(int x =1; x<=100;++x)
 {
 for(int y = (x > 70 ? x + 1 : 70); y<=200; y++)
 {
 if((x+y) % 7 == 0) count++;
 }
}
cout << count;
@marzoukali
marzoukali / cpp-simple-problems-third-perf-issue
Created May 29, 2017 15:39
C++ - Simple Problems - Problem 3 - Code With Performance Issue
int count = 0;
for(int a = 0; a < 100; a++)
{
for(int b = 0; b < 100; b++)
{
for(int c = 0; c < 100; c++)
{
for(int d = 0; d < 100; d++)
{
@marzoukali
marzoukali / gist:0fbb453252f41f0b4a1dfa2ae3da469c
Created May 29, 2017 15:48
C++ - Simple Problems - Problem 3 - Code Enhance Performance
int count = 0;
for(int a = 0; a < 100; a++)
{
for(int b = 0; b < 100; b++)
{
for(int c = 0; c < 100; c++)
{
int d = 100 - (a + b + c);
[TestFixture]
public class GameServiceTests
{
[Test]
public void GetGameById_WithValidId_ReturnsGame()
{
// Arrange and Act
var mockUnitOfWork = new Mock<IUnitOfWork>();
var mockQueries = new Mock<IQueries<Game>>();
var mockQueryable = new Mock<IQueryable<Game>>();
public class PrintInvoiceCommand
{
public void Execute(int invoiceId)
{
var database = new Database();
var invoice = database.GetInvoice(invoiceId);
Printer.WriteLine("Invoice ID: " + invoice.Id);