Skip to content

Instantly share code, notes, and snippets.

@redwraith2
redwraith2 / output_dependencies_of_file.py
Created March 15, 2023 05:10
This script create a text output of the dependency tree of a particular class file. This is useful for coding in ChatGPT because it will allow you to select a class file, a folder, and instantly grab all relevant code from that folder that is referenced either in that class file or a dependency. The script is a simple python script that: 1. take…
import os
import re
import tkinter as tk
from tkinter import filedialog
from datetime import datetime
def get_all_files_with_ext(path, ext):
files_with_ext = []
for root, dirs, files in os.walk(path):
for file in files:
readURL = (input, template, id) ->
filesToUpload = input.files
file = filesToUpload[0]
# Create an image
img = document.createElement('img')
# Create a file reader
reader = new FileReader
# Set the image once loaded into file reader
reader.onload = (e) ->
#When using UI Hooks, the docs will tell you to do it like this:
#This is wrong, but will work unless you are doing something that involves positioning. Namely autoscrolling behavior.
@find('#container')._uihooks = {
insertElement: ->
$(node).insertBefore(next)
#I researched how MDG does inserts themselves. They do it more like this:
#This works without an issue if you've implemented autoscrolling on this collection via template-level subscriptions.
#This is because this uses DOM insert rather than JQuery.
#It also, unfortunately, requires an additional piece of information - though one you likely already have! $('#container')
$('#container')[0].insertBefore(node, next)
//Exhibit 1: They're the same
Template.notifications.helpers({
notifications: function(){
return Notifications.find({userId: Meteor.userId(), read: false});
},
notificationCount: function(){
return Notifications.find({userId: Meteor.userId(), read: false}).count();
}
});