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
from django.conf.urls import url | |
from django.contrib import admin | |
from django.conf.urls import include | |
from first_app import views | |
urlpatterns = [ | |
url(r'^$',views.index,name='index'), | |
url(r'^admin/', admin.site.urls), | |
url(r'^first_app/',include('first_app.urls')), | |
] |
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
from django.conf.urls import url | |
from first_app import views | |
# is key word needs to be right | |
urlpatterns = [ | |
url(r'^$',views.index, name='index'), | |
] |
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
// here we have the type we are trying to extend the double | |
// notice how we can extend anything, even a built in type like Double | |
extension Double { | |
var km: Double { return self * 1_000.0 } | |
var m: Double { return self } | |
var cm: Double { return self / 100.0 } | |
var mm: Double { return self / 1_000.0 } | |
var ft: Double { return self / 3.28084 } | |
} |
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
// Array you wanna do the operation on | |
const peopleArray = [ {Name: "Tim", BankBalance: 10}, | |
{Name: "Leo", BankBalance: 20}, | |
{Name: "Sam", BankBalance: 30} ]; | |
// calling the Map function and having it return its value into | |
// reformattedArray. Where "obj" represents each object in the | |
// peopleArray | |
let reformattedArray = peopleArray.map((obj) =>{ |
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
// Here we have a list of all the transactions made by Mike | |
const transActionsForMike = [ {Name: "Bike", Cost: 5000}, | |
{Name: "Apple Music", Cost: 20}, | |
{Name: "Cook Book", Cost: 30}, | |
{Name: "Azure Hosting", Cost: 60}, | |
{Name: "Phone Bill", Cost: 70}]; | |
// And we try to figure out how much Mike Spent | |
// "reduce" takes in three main arguments, the Accumulator (acc), the | |
// currentValue (curr) in the form of an anonymous function. And a inital |
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 transActionsForMike = [ {Name: "Bike", Cost: 5000}, | |
{Name: "Apple Music", Cost: 20}, | |
{Name: "Cook Book", Cost: 30}, | |
{Name: "Azure Hosting", Cost: 60}, | |
{Name: "Phone Bill", Cost: 70}]; | |
// As seen in Reduce and Map, we can add more elements into the | |
// anonymous functions such as the index and the whole array | |
// filter gives us each element in the array. We then have to return |
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
// Note this is without any optimizations | |
const bubblesort = (arr) => { | |
// We have a loop here to slowly shrink how much of the array we cover | |
// So that we don't constantly keep looping over the whole array | |
for(let i = arr.length; i > 0; i--){ | |
// This loop, covers the length of the array given to us by the | |
// loop above. | |
for(let j = 0; j < i - 1; i ++){ | |
// Here we do the comparison that asks the question |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Dynamic Table</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<script> | |
$(document).ready(function() { | |
var data = { | |
ALL: [ | |
'SUPER_R:EditPages', |
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 LoanFormShould | |
{ | |
[Fact] | |
public async Task RenderApplicationForm() | |
{ | |
// Creating a web Host Builder to put in your test server | |
var builder = new WebHostBuilder() | |
.UseContentRoot(@"Enter your Path here to project") | |
.UseEnvironment("Development") | |
.UseStartup<loans.Startup>() |
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 void ConfigureServices(IServiceCollection services) | |
{ | |
if (CurrentEnvironment.IsDevelopment()) // Here is where we check | |
{ | |
services.AddDbContext<AppDbContext>( | |
options => options.UseInMemoryDatabase()); // And we ask it to use the InMemoryDatabase Option | |
} | |
else | |
{ | |
services.AddDbContext<AppDbContext>( |
OlderNewer