Skip to content

Instantly share code, notes, and snippets.

View bgoonz's full-sized avatar
🎯
learning

Bryan C Guner bgoonz

🎯
learning
View GitHub Profile
@bharathmuddada
bharathmuddada / CountofDigits.py
Created April 17, 2021 12:42
Count of Digits in Python
number = int(input())
counter =0
while number > 0:
number = number//10
print(number)
counter +=1
print("number of digits :",counter)
@Assistance4u
Assistance4u / PY0101EN-2-3-Dictionaries.ipynb
Created April 17, 2021 12:07
Created on Skills Network Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
getDiscountPercentageValue(products: Product[]): number {
let discountValue = 0;
if (products.length === 1) {
return 0;
}
let allProductsQuantity = products.reduce((sum, product) => sum + product.quantity, 0);
if (allProductsQuantity > 10 && allProductsQuantity <= 50) {
discountValue += 10;
def remove_instance(nums, val):
"""
Given an array nums, and a value val, returns the new length of the array with the value removed
i.e. the number of items in nums with val
Input: nums=[5, 2, 2, 5, 3] and val = 5
Output: 3
"""
try:
#check for cases of an empty array
if len(nums) == 0:
function exponentialBackoff(i, dt) {
const f = j => j >= 0 ? Math.exp(j/3)*dt : 0
const ret = f(i)-f(i-1)
if(ret < dt) {
return dt
} else {
return ret
}
}
@shinysu
shinysu / app.py
Created April 17, 2021 11:42
Todolist
from flask import Flask, render_template, request, redirect, url_for
from dbfunctions import add_new_task, get_complete_tasks, get_incomplete_tasks, mark_task_complete
app = Flask(
__name__,
template_folder = 'client/templates'
)
@app.route('/')
def index():
@k8scat
k8scat / install_python3.8_ubuntu16.sh
Last active April 17, 2021 16:54
Install Python3.8 on Ubuntu 16
#!/bin/bash
#
# Install Python3.8 and pip on Ubuntu 16
# Maintainer: k8scat@gmail.com
set -e
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update -y
apt-get install -y python3.8 python3.8-distutils
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
@deeppunj
deeppunj / PY0101EN-4-2-WriteFile.ipynb
Created April 17, 2021 11:38
Created on Skills Network Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.family'] = 'MEIRYO'
plt.rcParams["font.size"] = 18
w, h, dpi = 1920, 1080, 144
fig = plt.figure(figsize=(w / dpi, h / dpi), dpi=dpi, facecolor='white')
@zaydek
zaydek / virtualScroller.js
Created April 17, 2021 11:09
Probably a bad idea
React.useEffect(() => {
let animationFrame = 0
function virtualScroller(targets, { offset, topOffset, bottomOffset } = {}) {
offset ??= 0
topOffset ??= offset ?? 0
bottomOffset ??= offset ?? 0
cancelAnimationFrame(animationFrame)
animationFrame = window.requestAnimationFrame(() => {
for (let x = 0, len = targets.length; x < len; x++) {
let target = targets[x]