Skip to content

Instantly share code, notes, and snippets.

def simple_decorator(func):
def wrapper(*args, **kwargs):
condition = True
if condition:
return func(*args, **kwargs)
print('condition else')
return {'error_code': 1}
return wrapper
@DmitryBurnaev
DmitryBurnaev / remove_duplicates.py
Last active December 16, 2017 19:52
Remove duplicated items from list of custom objects
class A(object):
k = None
def __init__(self,k):
self.k = k
def __eq__(self, other):
return self.k == other.k
source_items = [A(i) for i in [1,2,3,4,3,2,3,6]]
@Miserlou
Miserlou / semantic-2.2.9.html
Created March 4, 2017 00:46
Semantic UI 2.2.9 CDN Starter
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Semantic UI CDN</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.js"></script>
</head>
<body>