Skip to content

Instantly share code, notes, and snippets.

View shofetim's full-sized avatar

Jordan Schatz shofetim

View GitHub Profile
def deprecated(func):
'''
This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emmitted
when the function is used.
'''
def newFunc(*args, **kwargs):
warnings.warn('Call to deprecated function %s.' % func.__name__,
category=DeprecationWarning)
from orders.constants import ORDER_STATUS_PLACED
sarahs = Vendor.objects.get(pk=38872)
ols = OrderLine.objects.filter(
order__order_status__lt=ORDER_STATUS_PLACED,
product__code__startswith='BB'
)
interesting = []
for ol in ols:
def generate_landed_costs():
path = os.path.join(settings.CACHE_ROOT, 'landed_costs.csv')
f = open(path, 'w')
w = UnicodeWriter(f)
w.writerow(
['Code', 'Length', 'Width', 'Height', 'Weight',
'Storage Climate', 'Pick Area', 'Repackaged', 'Name', 'Size',
'Retail Price', 'Pack Quantity', 'Average Ancillaries',
'Product Cost',
'Product Expected Landed Cost (now)',
SELECT
req.is_archived,
req.contact_name AS Name,
req.address_1 AS "Address 1",
req.address_2 AS "Address 2",
req.city AS City,
states.abbrev AS State,
states.name AS "State Name",
req.postal_code AS Zip,
req.email AS Email,
;; Story:
;; I have an EDN data structure from an external API
;; I extract several patterns of records from it.
;; I would like to treat the patterns as data, pass them around, modify them etc.
(def sample-data {:tracks {:items [1 2 3 4 5]}})
(def pattern [:tracks :items count])
;; Thread first -> should be what I need, but I need to "apply" it...
(apply -> (cons sample-data pattern)) ;; Can't take value of a macro: #'clojure.core/->
def login(request):
try:
data = json.loads(request.body)
username = data.get('username')
password = data.get('password')
except ValueError as error:
return JsonResponse.bad_request(message=unicode(error))
user = auth.authenticate(username=username, password=password)
if (user is not None) and user.is_active:
auth.login(request, user)
def login(request):
try:
payload = json.loads(request.body)
except ValueError as error:
return JsonResponse.bad_request(message=unicode(error))
username = payload.get('username', False)
password = payload.get('password', False)
if username and password:
else:
socketserver:
image: azurestandard/beehive
command: /srv/beehive/manage.py socketserver --settings=env.bh_dev
links:
- redis
- postgres
- es
environment:
- "REDIS_PORT=tcp://redis_1:6379"
- "POSTGRESQL_PORT=tcp://postgres_1:5432"

Onboarding

Tues - Wed next week onboarding.

  • Contract
  • Hardware
  • Access
    • Slack
    • Github
  • Basecamp

Onboarding

Tues - Wed next week onboarding.

  • Contract
  • Hardware
  • Access
    • Slack
    • Github
  • Basecamp