Skip to content

Instantly share code, notes, and snippets.

View ryanKinoti's full-sized avatar
🤔
Always Thinking

Ryan Kinoti ryanKinoti

🤔
Always Thinking
View GitHub Profile
@ryanKinoti
ryanKinoti / Dockerfile
Created April 27, 2024 07:48
edit-2: inside the load balancer folder... edit the dockerfile
FROM python:3.8-slim
WORKDIR /load_balancer
COPY . /load_balancer
RUN pip install --no-cache-dir -r requirements.txt
CMD ["python", "load_balancer.py"]
@ryanKinoti
ryanKinoti / Dockerfile
Created April 27, 2024 07:17
edits-1. open the dockerfile inside the app folder and copy paste
FROM python:3.8-slim
WORKDIR /server
COPY . /server
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000
@ryanKinoti
ryanKinoti / GoogleController.php
Created July 17, 2023 14:48
document/image saving
// Check if there is already a profile picture stored
if ($finduser->profile_picture) {
// Delete the existing profile picture file
Storage::delete($finduser->profile_picture);
}
//procedure for saving profile pictures
$avatarPath = 'public/avatars/employers/' . $user->id . '.jpg';
$avatarContents = file_get_contents($user->getAvatar());
Storage::put($avatarPath, $avatarContents);
$finduser->profile_picture = $avatarPath;
@ryanKinoti
ryanKinoti / Routing.php
Created July 7, 2023 07:01
route redirect
public function accounts()
{
if (request()->is('auth/login')) {
$user = Auth::user();
if ($user == null) {
return view('auth.login');
}
return redirect("/")->withErrors(['error' => "You are already logged in"]);
} elseif (request()->is('auth/registration')) {
@ryanKinoti
ryanKinoti / .env
Created July 6, 2023 18:28
a copy of my env file to use
APP_NAME="Arcadian Bank"
APP_ENV=local
APP_KEY=base64:xzdgkUE3qMUQkvT3IXvwq9hnBmnk/IAbXu6bVLt/f4s=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
@ryanKinoti
ryanKinoti / AuthController.php
Created June 23, 2023 00:45
reset password method
public function resetPassword(Request $request)
{
$new_password = Hash::make($request->input('new_password'));
$user_update = User::all()->where('id', '=', $request->input('user_id'))->first();
$user_update->password = $new_password;
$user_update->email_verified_at = Carbon::now();
$user_update->update();
return redirect()->route('/')->withErrors(['msg' => 'Password Reset Successfully.']);
}
@ryanKinoti
ryanKinoti / dashboard.blade.php
Last active June 22, 2023 19:41
Tab switching action
<script>
// tab switching
function switchcommon(evt, mainName) {
var i, tabcontent, tablinks;
//get all elements under tabcontent and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");