HTML for basic chat app
<div id="chat">
<div class="msg">
lorem...
</div>
<div class="msg">
lorem...
</div>
from itsdangerous import URLSafeTimedSerializer | |
from project import app | |
def generate_confirmation_token(email): | |
serializer = URLSafeTimedSerializer(app.config['SECRET_KEY']) | |
return serializer.dumps(email, salt=app.config['SECURITY_PASSWORD_SALT']) |
HTML for basic chat app
<div id="chat">
<div class="msg">
lorem...
</div>
<div class="msg">
lorem...
</div>
''' | |
Run the following commands (bc. gists don't allow directories) | |
pip install flask django dj-database-url psycopg2 | |
mkdir -p app/migrations | |
touch app/__init__.py app/migrations/__init__.py | |
mv models.py app/ | |
python manage.py makemigrations | |
python manage.py migrate |
require 'sidekiq/api' | |
# 1. Clear retry set | |
Sidekiq::RetrySet.new.clear | |
# 2. Clear scheduled jobs | |
Sidekiq::ScheduledSet.new.clear |
rank | combo | |
---|---|---|
1 | AA | |
2 | KK | |
3 | ||
4 | AKs | |
5 | JJ | |
6 | AQs | |
7 | KQs | |
8 | AJs | |
9 | KJs |
.aaa | |
.aarp | |
.abarth | |
.abb | |
.abbott | |
.abbvie | |
.abc | |
.able | |
.abogado | |
.abudhabi |
create temporary table temp (symbol varchar(255), open decimal, high decimal, low decimal, close decimal, volume varchar(255), date date ); | |
create table if not exists stocks (id serial primary key, symbol varchar(255), open decimal, high decimal, low decimal, close decimal, volume varchar(255), date date, created_at timestamp, updated_at timestamp); | |
copy temp (symbol, date, open, high, low, close, volume) from '/path/to/file.csv' with delimiter ',' csv header; | |
delete from stocks using temp where stocks.date = temp.date and stocks.symbol = temp.symbol; | |
insert into stocks (symbol, open, high, low, close, volume, date) select symbol, open, high, low, close, volume, date from temp; |
# set up /etc/hosts | |
# 127.0.0.1 site1.loc site2.loc | |
from flask import ( | |
Flask | |
) | |
import site1, site2 | |
app = Flask(__name__) |
#http://stackoverflow.com/questions/5870188/does-flask-support-regular-expressions-in-its-url-routing | |
#Even though Armin beat me to the punch with an accepted answer I thought I'd show an abbreviated example of how I implemented a regex matcher in Flask just in case anyone wants a working example of how this could be done. | |
from flask import Flask | |
from werkzeug.routing import BaseConverter | |
app = Flask(__name__) | |
class RegexConverter(BaseConverter): | |
def __init__(self, url_map, *items): |
// http://rubular.com/r/twBPG8HQgP | |
regex = /\S+[a-z0-9]@[a-z0-9\.]+/img | |
"hello sean@example.com how are you? do you know bob@example.com?".match(regex) | |
// ["sean@example.com", "bob@example.com"] |