add_to_21([2, 32, 11, 1, 34, 18])
[]
add_to_21([1, 23, 19, 32, 1, 20, 7, 14])
[20, 1]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl --header "X-HRIS-AUTHENTICATION: 773603159c636db69c1e596c68a6368624305bcb" \ | |
--header "Content-Type: application/json" \ | |
-X POST \ | |
-d '{"users": [{"phone_number": "+1 223-334-4355", "last_name": "Doe", "profile_image": {"url": "https://s3.amazonaws.com/publicassets.7geese.com/misc/765-default-avatar.png", "last_modified": 23323123123123, "cache_info": "sadsaDSds343GzzZ"}, "manager": {"hris_id": "E9923443"}, "active": true, "hris_id": "1FdzdQf35CffSd53", "first_name": "John", "employee_id": "E123556", "departments": ["Engineering > Mobile Team", "Customer Success > Support > Mobile Support", "Sales > Sales Engineer"], "email": "[email protected]", "job_title": "VP Engineering"}]}' \ | |
https://app.7geese.com/hriswebhook/sync/e4a777a9021349fc9d061bd60fe1ec20/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"users": [ | |
{ | |
"hris_id": "1FdzdQf35CffSd53", | |
"first_name": "John", | |
"last_name": "Doe", | |
"email": "[email protected]", | |
"job_title": "VP Engineering", | |
"phone_number": "+1 223-334-4355", | |
"employee_id": "E123556", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"type": "object", | |
"properties": { | |
"users": { | |
"type": "array", | |
"items": { | |
"type": "object", | |
"properties": { | |
"hris_id": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from caching.invalidation import make_key | |
from functools import partial | |
def get_response_key(request): | |
smooshed = [] | |
cache_keys = request.GET.keys() | |
cache_keys.sort() | |
for key in cache_keys: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from caching.base import cached_with as official_cached_with | |
def cached_with(obj, f, f_key, timeout=None): | |
"""Helper for caching a function call within an object's flush list.""" | |
if hasattr(obj, "exists") and not obj.exists(): | |
return f() | |
return official_cached_with(obj, f, f_key, timeout=timeout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'root': { | |
'level': 'WARNING', | |
'handlers': ['sentry'], | |
}, | |
'formatters': { | |
'verbose': { | |
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from django.utils.text import compress_string | |
from django.utils.cache import patch_vary_headers | |
from django import http | |
try: | |
import settings | |
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
The MIT License (MIT) | |
Copyright (c) 2011 Numan Sachwani | |
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from boto.ec2.elb import ELBConnection | |
from boto.ec2.elb import HealthCheck | |
conn_elb = ELBConnection(AWS_ACCESS_KEY, AWS_SECRET_KEY) | |
#For a complete list of options see http://boto.cloudhackers.com/ref/ec2.html#module-boto.ec2.elb.healthcheck | |
hc = HealthCheck('healthCheck', | |
interval=20, | |
target='HTTP:80/index.html', |
NewerOlder