Skip to content

Instantly share code, notes, and snippets.

View draganHR's full-sized avatar

Dragan Bošnjak draganHR

View GitHub Profile
@OliverMensahDev
OliverMensahDev / Journey_into_all_bles_of_code.md
Last active November 27, 2023 11:59
Journey into writing code that is readable, understandable ,maintainable and testable as well as how to prepare codebase to embrace future changes.

Journey into writing code that is readable, understandable ,maintainable and testable as well as how to prepare codebase to embrace future changes.

I wonder from time to time whether I'm doing the right thing with respect to guidelines and principles when using an object-oriented programming approach to create application. I started reading Object Design Style Guide book last year to learn more about objects. And beginning this year, I decided to delve deeper into writing code that is readable, understandable and maintainable as well as how to prepare codebase to embrace future changes.

Here are the resources used:

Book

  • Object Design Style Guide:
  • Principles of Package Design

Pluralsight Courses

  • Writing Readable and Maintainable Code
@grantjenks
grantjenks / xml_rpc_client_unix_domain_socket.py
Created October 22, 2019 03:42
Python 3 XML-RPC Using Unix Domain Sockets
import http.client
import socket
import xmlrpc.client
class UnixStreamHTTPConnection(http.client.HTTPConnection):
def connect(self):
self.sock = socket.socket(
socket.AF_UNIX, socket.SOCK_STREAM
)
@draganHR
draganHR / format-python2.6.md
Created November 26, 2015 09:39
Cheat sheet for "new style" string formatting in Python 2.6.

Cheat sheet for "new style" string formatting in Python 2.6. It is modified version of examples from http://pyformat.info/ Difference is that simplest sytaxt ( '{}'.format('foo') ) does not work in Python 2.6 and you need to specify value index for each value ( '{0}'.format('foo') ).

Format:

'{1} {0}'.format('one', 'two')

Align right:

@chantastic
chantastic / on-jsx.markdown
Last active March 20, 2024 01:03
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@bobbygrace
bobbygrace / trello-css-guide.md
Last active May 15, 2024 16:01
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@senko
senko / maybe.py
Last active May 2, 2024 18:35
A Pythonic implementation of the Maybe monad
# maybe.py - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
import json
import simplejson
import timeit
data = {
"firstName": "John",
"lastName": "Smith",
"age": 25,
"address": {
"streetAddress": "21 2nd Street",
@cha55son
cha55son / dynmotd
Last active June 9, 2023 21:06
RHEL (Centos/Fedora) dynamic motd
#!/bin/bash
# Installation:
#
# 1. vim /etc/ssh/sshd_config
# PrintMotd no
#
# 2. vim /etc/pam.d/login
# # session optional pam_motd.so
#
@paneq
paneq / page.conf
Created April 3, 2013 14:57
nginx maintenance page that is JSON friendly
if (-f $document_root/system/maintenance.html) {
return 503;
}
error_page 503 @maintenance;
location @maintenance {
internal;
if ($http_accept ~ json) {
return 503 "{}";
}