Skip to content

Instantly share code, notes, and snippets.

Avatar
🔨
Building

Cozy! ItsCosmas

🔨
Building
View GitHub Profile
@ItsCosmas
ItsCosmas / BowlingHashMap.java
Last active Jan 25, 2021
Sololearn Various Ways to Iterate a HashMap and outputs the name of the player with the maximum points. https://www.sololearn.com/learning/eom-project/1068/972
View BowlingHashMap.java
package com.cozy;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class BowlingHashMap {
HashMap<String, Integer> players;
BowlingHashMap() {
@ItsCosmas
ItsCosmas / command.sh
Created May 12, 2020
Docker stop and delete all containers
View command.sh
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
@ItsCosmas
ItsCosmas / send.py
Created Feb 4, 2020
Send an Image file to client on Python Flask REST
View send.py
from flask.views import MethodView
from flask import jsonify, request, abort
import uuid
import os
from werkzeug.utils import secure_filename
class MediaAPI(MethodView):
def __init__(self):
@ItsCosmas
ItsCosmas / upload.py
Created Feb 4, 2020
Upload Image Files with Python Flask via REST API
View upload.py
from flask.views import MethodView
from flask import jsonify, request, abort
import uuid
import os
from werkzeug.utils import secure_filename
class UploadAPI(MethodView):
def __init__(self):
@ItsCosmas
ItsCosmas / upload.py
Created Feb 4, 2020
Upload Base_64 Image File with Python Flask via REST API
View upload.py
from flask.views import MethodView
from flask import jsonify, request, abort
import uuid
import os
from io import BytesIO
from PIL import Image
import base64
View rename_multiple_files.py
import os
i = 0
for file in os.listdir("."):
dst = str(i) + ".jpeg"
src = file
dst = dst
os.rename(src,dst)
i +=1
View Article.scss
@import "../../assets/scss/abstracts/variables";
@import "../../assets/scss/abstracts/mixins";
.article {
padding: 4rem;
// Article Main Body
&__main {
padding: 2rem 10rem 10rem 10rem;
}
View ArticleView.jsx
import React from "react";
import hotpost from "../../assets/img/hot-post-1.jpg";
const ArticleView = () => {
return (
<div className='article__header'>
<h4 className='heading-main'>The Blog Heading Goes Here</h4>
<div className='article__credits'>
Written by <span className='article__author'>Cosmas Cozy </span>
on <span className='article__date'>22 Oct 2019</span>
View ArticleShare.jsx
import React, { Component } from "react";
import sprite from "../../assets/icons/sprite.svg";
class ArticleShare extends Component {
socialItems = [
{ id: 1, name: "icon-facebook", link: "https://facebook.com" },
{ id: 2, name: "icon-twitter", link: "https://twitter.com" },
{ id: 3, name: "icon-instagram", link: "https://instagram.com" },
{ id: 4, name: "icon-linkedin", link: "https://linkedin.com" }
View Article.jsx
// The Home Page
import React, { Component } from "react";
import ArticleView from "./ArticleView";
import ArticleShare from "./ArticleShare";
import BlogCardCol from "../Blog/BlogCardCol";
import "./Article.scss";
class Article extends Component {