Skip to content

Instantly share code, notes, and snippets.

View chuckis's full-sized avatar
🔍
In the beginning was the Word,

Ruslan chuckis

🔍
In the beginning was the Word,
  • 04:20 (UTC +03:00)
View GitHub Profile
@chuckis
chuckis / 1.srp.py
Created May 14, 2023 16:51 — forked from dmmeteo/1.srp.py
SOLID Principles explained in Python with examples.
"""
Single Responsibility Principle
“…You had one job” — Loki to Skurge in Thor: Ragnarok
A class should have only one job.
If a class has more than one responsibility, it becomes coupled.
A change to one responsibility results to modification of the other responsibility.
"""
class Animal:
def __init__(self, name: str):
@chuckis
chuckis / Совершенный код. Ключевые.md
Created August 16, 2022 10:21
Ключевые моменты из книги Стива Макконнелла "Совершенный код"

Часть 1. Основы разработки ПО

Каждый язык программирования имеет достоинства и недостатки. Вы должны знать отдельные достоинства и недостатки используемого языка. Определите конвенции программирования до начала программирования. Позднее адаптировать к ним код станет почти невозможно. Методик конструирования слишком много, чтобы использовать все в одном проекте. Тщательно выбирайте методики, наиболее подходящие для вашего проекта. Спросите себя, являются ли используемые вами методики программирования ответом на выбранный язык программирования или их выбор был определен языком. Помните, что программировать следует с использованием языка, а не на языке. Эффективность конкретных подходов и даже возможность их применения зависит от стадии развития соответствующей технологии.

@chuckis
chuckis / gist:b7061e8c0c09a64c818bce62d0915f2a
Created May 11, 2021 18:03 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
<div class="table-responsive" style="max-width:400px"><table class="table table-hover table-bordered table-condensed table-list"> <tbody> <tr bgcolor="#FCF8F8" class="scrollable bordered"> <td height="33"><div align="left">AGE</div></td> <td>DEATH RATE<br> confirmed cases <br></td> <td>DEATH RATE<br> all cases</td> </tr> <tr class="scrollable bordered"> <td width="244"><div align="left"><strong>80+ years old </strong></div></td> <td width="125"><div align="right"><strong>21.9%</strong></div></td> <td width="125"><div align="right"><strong>14.8%</strong></div></td> </tr> <tr class="scrollable bordered"> <td><div align="left"><strong>70-79 years old </strong></div></td> <td><div align="right"></div></td> <td><div align="right"><strong>8.0%</strong></div></td> </tr> <tr class="scrollable bordered"> <td><div align="left"><strong>60-69 years old </strong></div></td> <td><div align="right"></div></td> <td><div align="right"><strong>3.6%</strong></div></td> </tr> <tr class="scrollable bordered"> <td><div align="left
@chuckis
chuckis / trapping_water.java
Created January 5, 2018 11:08
Trapping rain water algorythm
Problem
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
For example,
Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.
The below elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped.
@chuckis
chuckis / 0. description.md
Created January 1, 2018 21:28 — forked from Integralist/0. description.md
Clojure deftype, defrecord, defprotocol
  • defprotocol: defines an interface
  • deftype: create a bare-bones object which implements a protocol
  • defrecord: creates an immutable persistent map which implements a protocol

Typically you'll use defrecord (or even a basic map);
unless you need some specific Java inter-op,
where by you'll want to use deftype instead.

Note: defprotocol allows you to add new abstractions in a clean way Rather than (like OOP) having polymorphism on the class itself,

@chuckis
chuckis / cannonballs.py
Created May 10, 2017 21:04
задача о ядрах
# 1.Cannonballs
#
# A new kind of cannon is being tested. The cannon shoots cannonballs in a fixed direction. Each cannonball flies horizontally until it hits the ground, and then it rests there. Cannonballs are shot from different heights, so they hit the ground at different points.
# You are given two zero-indexed arrays, A and B, containing M and N integers respectively. Array A describes the landscape in the direction along which the cannon is shooting. Elements of array A represent the height of the ground, going from the cannon outwards. Array B contains levels from which consecutive cannonballs are shot.
# Assume that a cannonball is shot at level H.
# Let I be the smallest index, such that 0 < I < M and A[I] ≥ H. The cannonball falls at position I − 1 and increases the ground level A[I−1] by 1.
# If there is no such I, and H > A[I] for all 0 ≤ I < M, then the cannonball flies beyond the horizon and has no effect on the result.
# If H ≤ A[0], then the cannonball ricochets away and has no effect on the
@chuckis
chuckis / jackdrc
Created July 18, 2016 04:47
jackdrc
/usr/bin/jackd -P1 -dalsa -dhw:0 -r44100 -p1024 -n2 psuspender --jackd
//Enter OpenSCAD code here.
module 200_balka(){
translate ([0, 0, 10])cube([10, 10, 200]);
}
module 125_balka(){
rotate([90, 0, 90]) cube([10, 10, 125]);
}
module 240_balka(){
@chuckis
chuckis / inner-pad.scad
Created June 1, 2016 16:34
part of all-pad
// inner-pad.scad
//lad-cube.scad
module one-romb() {
scale ([1, 0.7, 1]) rotate ([45, 0, 0]) cube([30, 1, 1], center=true);
}
//lad-rombs.scad
module lad-rombs() {
for(i= [1 : 30]){
translate ([0, i - (i * 0.3), 0]) one-romb();