Skip to content

Instantly share code, notes, and snippets.

@davidimoore
davidimoore / list_indexes_in_rails_console.rb
Created January 4, 2024 22:56 — forked from davygora/list_indexes_in_rails_console.rb
Get list of all indexes in rails console.
# rails console
ActiveRecord::Base.connection.tables.each do |table|
indexes = ActiveRecord::Base.connection.indexes(table)
if indexes.length > 0
puts "====> #{table} <===="
indexes.each do |index|
puts "----> #{index.name}"
end
puts "====> #{table} <===="
@davidimoore
davidimoore / traceback_exc.py
Created November 1, 2023 22:12 — forked from rpdelaney/traceback_exc.py
Serialize python exceptions into dictionaries
import traceback
from typing import Dict, Union, List
def traceback_exc(exc: Exception) -> Dict[str, Union[str, List[str]]]:
tb = traceback.TracebackException.from_exception(
exc, capture_locals=True
)
return {
"title": type(exc).__name__,
@davidimoore
davidimoore / _aws.graphql
Last active July 14, 2024 15:34 — forked from sc0ttdav3y/_aws.graphql
AWS AppSync GraphQL scalars and directives to support type completion and error checking in Webstorm IDEs
# These are here to help the IDE recognise AWS types.
#
# Place this file outside the 'schema' directory so are not pushed to AWS,
# but are still picked up by PhpStorm's GraphQL plugin to help
# validate schemas.
#
# https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html
#
scalar AWSDateTime
scalar AWSDate
@davidimoore
davidimoore / 0_reuse_code.js
Last active September 10, 2015 20:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console