Skip to content

Instantly share code, notes, and snippets.

🕶
Loading...

Austin Walters lettergram

🕶
Loading...
Block or report user

Report or block lettergram

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lettergram
lettergram / activerecord_subquery.rb
Last active May 18, 2019
Create a subquery in Rails using Active Record
View activerecord_subquery.rb
query = select(:author, :created_at)
.from(
where("created_at >= ?", Date.today - 6.months)
.order(created_at: :desc)
.limit(100)
).order(author: :asc)
@lettergram
lettergram / postgresql_subquery.sql
Last active May 14, 2019
Create a subquery in PostgreSQL
View postgresql_subquery.sql
/**
* comments
* author
* comment_text
* created_at
**/
SELECT author, created_at FROM
(SELECT * FROM comments WHERE (created_at >= NOW() - interval '6 month')
ORDER BY created_at DESC LIMIT 100) subquery
ORDER BY author ASC;
@lettergram
lettergram / sync_lists_across_files.py
Last active Feb 27, 2019
Syncronize content of files across directories, keeping the most up-to-date edits
View sync_lists_across_files.py
# Syncronize files across directories, keeping the most up-to-date edits
lists = [
'directory_1/list_of_terms.yaml',
'directory_2/list_of_terms.txt'
]
list_items = {} # Form: [item] = [time(integer), keep(boolean)]
# Generate full list of single_listed items (stores all possible terms)
View HelloWorms_FloatFix_OffByOne.py
# Python Implementation of Hello Worms
string = bytearray("Hello, Worms!", 'UTF-8')
for i in range(int(len(string) / 2)): # Cast to int for Range
temp = string[i]
string[i] = string[len(string) - i - 1] # -1 or error
string[len(string) - i - 1] = temp # add -1 or error
print(string.decode('UTF-8'))
View HelloWorms_FloatFix.py
# Python Implementation of Hello Worms
string = "Hello, Worms!"
for i in range(int(len(string) / 2)): # Cast to int for range
temp = string[i]
string[i] = string[len(string) - i]
string[len(string) - i] = temp
print(string)
View HelloWorms.py
# Python Implementation of Hello Worms
string = bytearray("Hello, Worms!", 'UTF-8')
for i in range(len(string) / 2):
temp = string[i]
string[i] = string[len(string) - i - 1]
string[len(string) - i - 1] = temp
print(string.decode('UTF-8'))
View austins-protonmail-theme.css
#pm_view {
min-width:70%;
}
#conversation-list-columns{
border-right:none;
background:#F7F6F6;
max-width:30%;
}
#conversation-view{
min-width:68%;
@lettergram
lettergram / austins-proton-theme-conversations.css
Last active Jan 20, 2019
CSS For ProtonMail Conversations
View austins-proton-theme-conversations.css
/* Conversation List Style */
.conversation{
background:#F8EFFB;
border-color: #FFFFFF;
border-width: thin;
}
.conversation.read{
background:#DDDDDD;
border-color:#DDDDDD;
border-width:none;
@lettergram
lettergram / austins-proton-theme-inboxtray.css
Last active Jan 20, 2019
ProtonMail CSS for Conversation List
View austins-proton-theme-inboxtray.css
#pm_view {
min-width:70%;
}
#conversation-list-columns{
border-right:none;
background:#F7F6F6;
max-width:30%;
}
#conversation-view{
min-width:68%;
View import_export_embedding.py
def import_embedding(embedding_name="data/default"):
if not embedding_name:
return None, None
file_flag = os.path.isfile(embedding_name+"_word_encoding.json")
file_flag &= os.path.isfile(embedding_name+"_cat_encoding.json")
if not file_flag:
return None, None
You can’t perform that action at this time.