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
""" | |
This snippet will return all the letting agents, bucket into discrete bands based on distance from | |
an origin point (for example, the user's current location), then sorted alphabetically within each | |
bend. The goal being to prioritise agents in close proximity, but not execessively so -- all agents | |
within the same band should be given equal distance-related priority. | |
If there's a search term, we then boost the distance score based on the name's similiarity to the | |
search query. | |
""" | |
qs = LettingAgentLocation.objects.select_related("agent").filter(postcode__isnull=False) |
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
#!/usr/bin/env python | |
import argparse | |
import os | |
import subprocess | |
import sys | |
import time | |
# Required so we don't generate tons of logs during restore | |
disable_logging_sql = "ALTER USER postgres RESET pgaudit.log;" |
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 os | |
import pickle | |
import warnings | |
import numpy as np | |
import pandas as pd | |
from sklearn.model_selection import train_test_split | |
from tensorflow.keras.callbacks import EarlyStopping | |
from tensorflow.keras.layers import Dense | |
from tensorflow.keras.layers import Dropout |
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
-- Collision-resistant ids optimized for horizontal scaling and performance, for PL/PgSQL. | |
-- Based on https://github.com/ericelliott/cuid | |
-- Version 1.0.0 | |
-- Usage: SELECT cuid(); | |
-- BEGIN CONFIG --- | |
-- Put a unique host ID (int) here per server instance. | |
-- Once set, this value should not be changed. |
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 * as redis from "redis"; | |
import * as Websocket from "ws"; | |
import { v4 } from "uuid"; | |
import * as http from "http"; | |
function noop() {} | |
enum WebsocketSendType { | |
BROADCAST_EMIT = "BROADCAST_EMIT", | |
} |
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
<template> | |
<div> | |
<label v-if="label" class="form-label" :for="`date-input-${_uid}`">{{ label }}:</label> | |
<input v-bind="$attrs" class="form-input" :id="`date-input-${_uid}`" :class="{ error: error }" type="text" ref="input" :value="value" @change="change" @keyup="change"> | |
<div v-if="error" class="form-error">{{ error }}</div> | |
</div> | |
</template> | |
<script> | |
import pikaday from 'pikaday' |
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
defmodule Test do | |
def thing() do | |
1+1 | |
end | |
defmacro my_macro do | |
quote do | |
1 + 1 | |
end | |
end |
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 jobs import send_welcome_email | |
# ... | |
def register_user(): | |
user = do_the_registration() | |
send_welcome_email.transaction_aware_delay(user.id) | |
# or | |
# send_welcome_email.request_aware_delay(user.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
""" | |
Utilities for working with bulk data and batches. | |
""" | |
import itertools | |
def batches(items, batch_size=500): | |
""" | |
Given an iterable of items and a batch size, yield individual lists | |
of items of maximum length `batch_size`. |
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 node:8 | |
WORKDIR /home/node/app | |
ADD https://github.com/Yelp/dumb-init/releases/download/v1.1.1/dumb-init_1.1.1_amd64 /usr/local/bin/dumb-init | |
RUN chmod +x /usr/local/bin/dumb-init | |
COPY package.json yarn.lock ./ | |
RUN yarn --pure-lockfile | |
COPY . . |
NewerOlder