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
# projects/admin.py | |
from django.contrib import admin | |
from projects.models import Project | |
class ProjectAdmin(admin.ModelAdmin): | |
pass | |
admin.site.register(Project, ProjectAdmin) |
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.contrib import admin | |
from django.urls import include, path | |
urlpatterns = [ | |
path('admin/', admin.site.urls), | |
path("", include("pages.urls")), | |
path("projects/", include("projects.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
# projects/urls.py | |
from django.urls import path | |
from projects import views | |
urlpatterns = [ | |
path("", views.project_index, name="project_index"), | |
path("<int:pk>/", views.project_detail, name="project_detail"), |
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 { Component, OnInit } from '@angular/core'; | |
import {DataService} from "../../services/data.service"; | |
@Component({ | |
selector: 'app-category', | |
templateUrl: './category.component.html', | |
styleUrls: ['./category.component.css'] | |
}) | |
export class CategoryComponent implements OnInit { | |
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 { Injectable } from '@angular/core'; | |
import {HttpClient} from '@angular/common/http'; | |
import {Observable} from "rxjs"; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class DataService { |
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
pluginManagement { | |
repositories { | |
gradlePluginPortal() | |
google() | |
mavenCentral() | |
} | |
} | |
dependencyResolutionManagement { | |
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | |
repositories { |
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
plugins { | |
id 'com.android.application' | |
id 'org.jetbrains.kotlin.android' | |
id 'kotlin-kapt' | |
id 'kotlin-android-extensions' | |
id 'com.google.dagger.hilt.android' | |
} | |
android { |
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
//add up to | |
// Time Complexity: O(1) | |
// Mathematical formula | |
fun addTo(n: Int): Int { | |
val result = n * (n + 1) / 2 | |
print(result) | |
return result | |
} |
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
fun isUnique(str: String): Boolean { | |
val set = mutableSetOf<Char>() | |
for (i in str.indices) { | |
if (set.contains(str[i])) { | |
return false | |
} | |
set.add(str[i].lowercaseChar()) | |
} | |
return true | |
} |
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 get_total_number_from_last_picker(int n, int p, int q) { | |
int total_P = 0; | |
int p_turns = 0; | |
int total_Q = 0; | |
int q_turns = 0; | |
for (n=n; n>0; n=n-p) { | |
n = n - p; | |
total_P +=p; | |
p_turns++; |
NewerOlder