Skip to content

Instantly share code, notes, and snippets.

View prodeveloper's full-sized avatar

Jacob Chencha prodeveloper

View GitHub Profile
@prodeveloper
prodeveloper / soduku.py
Created May 24, 2024 16:14
Solving sodoku
def solve_soduku(grid):
i,j =0,0
while(i<9):
while(j<9):
if(grid[i][j]==0):
if try_fill_missing_recursively(grid,i,j)==False:
return False
j+=1
j=0
i+=1
@prodeveloper
prodeveloper / index.html
Created June 19, 2018 07:00
Introduction to forms
{% extends 'layout.html'%}
{% block content%}
<body>
<div class="container">
<form action="{{url_for('results')}}" method = "POST">
<div class="form-group">
<label for="val1">Input value 1</label>
<input type="text" class="form-control" id="val1" placeholder="Value 1" name="val1">
@prodeveloper
prodeveloper / index.html
Created June 19, 2018 07:00
Introduction to forms
{% extends 'layout.html'%}
{% block content%}
<body>
<div class="container">
<form action="{{url_for('results')}}" method = "POST">
<div class="form-group">
<label for="val1">Input value 1</label>
<input type="text" class="form-control" id="val1" placeholder="Value 1" name="val1">
@prodeveloper
prodeveloper / dup_removal.py
Created May 2, 2018 06:45
Removing duplicates
def answer(numbers):
seen = set()
counter = 0
zero_counter=0
unique = []
duplicate_value=None
numbers.insert(0,0)
for x in numbers:
if x in seen:
duplicate_value = x
@prodeveloper
prodeveloper / exercise1.txt
Last active March 27, 2018 06:56
End of semester challenge
Write a script that converts celsius to farnheit
The formula for doing so would be:
(°C × 9/5) + 32 = °F or in plain English, Multiple by 9, then divide by 5, then
add 32.
The script should take input from STDIN.
@prodeveloper
prodeveloper / circle.py
Last active March 20, 2018 09:09
Class Demo for rectangle and circle
import math
class Circle:
radius = 0
def __init__(self,radius):
self.radius = radius
def validateDimension(self):
try:
self.width = float(self.radius)
@prodeveloper
prodeveloper / assignment.py
Created March 6, 2018 09:37
Validation and working with files 6th March
class Student:
def __init__(self, names, email):
self.names = names
self.email = email
self.validateEmail()
self.validateName()
def validateEmail(self):
pass
@prodeveloper
prodeveloper / working_with_image.md
Last active September 15, 2024 19:05
How to upload and use images on your Django application

Working with images

We now have everything we need to build a web app, except for images and other binary files. Your application will likely not get a lot of engagement if its not visual. In this lesson, we shall be adding the ability to upload images to your Posts api.

Since this will be a continuation from the class on Deploying to production you are adviced to start by cloning that workspace and then working from there.

Step 1

@prodeveloper
prodeveloper / deploying_simple_api.md
Last active May 21, 2023 06:21
Deploying your RESTful API to heroku

In this session, we are going to mimic a posts api that we worked on in a previous class. Typecode provides the free sample api.

APIs are what enable the backend, frontend and your mobile application to work together. We have also seen how to build basic REST api using Django Rest Framework

To get the post API to work we will need to work on four modules:

@prodeveloper
prodeveloper / deploying_to_heroku.md
Last active October 28, 2021 10:55
Deploying your application to a heroku server

For the lesson today, we are going to deploy our application to a live server.

The current workspace provided by cloud9 is meant only for development and not for production. By that, we mean you can use the service to write and even test your code but not to run your service.

For this we will be using a platform called heroku. Heroku is a PAAS (Platform As A Service).

This means you will not need to work VMs and such. Heroku will work with your code as long as you push it, which do using a similar technique.

The main things to consider when hosting your code will be: