Skip to content

Instantly share code, notes, and snippets.

View marksparrish's full-sized avatar

Mark Parrish marksparrish

View GitHub Profile
@marksparrish
marksparrish / street_name.txt
Created March 27, 2024 14:16
Elasticsearch StreetName synonyms
alley,allee
alley,alley
alley,ally
alley,aly
aly,allee
aly,alley
aly,ally
aly,aly
annex,anex
annex,annex
@marksparrish
marksparrish / first_name.txt
Created March 27, 2024 14:13
Elasticsearch FirstName Synonyms
aaliyah => alea, aleah, aleaseya, aleeya, alia, aliya, aliyah, allyiah
aaron => ahron, aron, arron
aarti => arti
aayesha => ayasha, ayesha, ayisha, ayse
aba => abod, abony, abos
abagail => abbe, abbey, abbie, abby, abigail, abigale, abigayle, abihail, abilio, gail
abba => abbe, abbot, abbott, absa
abbe => abagail, abba, abbey, abbie, abbot, abbott, abby, abigail, abigale, abigayle, abihail, abilio, absa, gail
abbey => abagail, abbe, abbie, abby, abigail, abigale, abigayle, abihail, abilio, gail
abbiah => abia, abiam, abijah
<?php
/**
* Updated app/Policies/TeamPolicy.php
*/
namespace App\Policies;
use App\Models\Team;
use App\Models\User;
<?php
/*
Updated config/fortify.php file
*/
use App\Providers\RouteServiceProvider;
use Laravel\Fortify\Features;
return [
<html lang="en"><head><style type="text/css" data-tag-name="trix-editor">trix-editor {
display: block;
}
trix-editor:empty:not(:focus)::before {
content: attr(placeholder);
color: graytext;
cursor: text;
}
def data_contract():
return {
'good_column_header': ['possible_header_1', 'possible_header_2],
'another_good_column': ['only_one_possible_header']
}
def _validate_data_contract(df):
vdf = pd.DataFrame(data=None)
df_columns = df.columns
for key, possible_headers in data_contract().items():
@marksparrish
marksparrish / get_table_columns.py
Created January 15, 2022 15:38
Get Table Column using SQLAlcemy
from sqlalchemy import MetaData, Table
from models import engines
# engine is expecting a create_engine
def get_table_columns(table_name, engine):
metadata = MetaData()
meta_table_columns = Table(table_name, metadata, autoload_with=engine).columns
table_columns = []
for name in meta_table_columns:
@marksparrish
marksparrish / dbx.py
Created January 5, 2022 15:20
Dropbox Zipfile CSVs to pandas
import io
import zipfile
import dropbox
import pandas as pd
def get_dropbox():
dropbox_path = "path/to/dropbox/files"
dbx = dropbox.Dropbox('DROPBOX_KEY')
# get listing of files
dbx_files = dbx.files_list_folder(dropbox_path)
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateOrderProductTable extends Migration
{
/**
* Run the migrations.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProductTagTable extends Migration
{
/**
* Run the migrations.