cmc/cleberg.net

My personal web garden & blog.

clone: git clone https://gitbay.org/cmc/cleberg.net.git

0e208c86010343086eeb96b2f69c7329c03aecae

unsigned

author: Christian Cleberg <hello@cleberg.net> · 2024-10-31T15:05:34Z

minor enhancements
 README.org                    | 65 ++++++++++++++++++++++++++-----------------
 utils/salary_visualization.py | 45 ++++++++++++++++++++++--------
 2 files changed, 74 insertions(+), 36 deletions(-)

diff --git a/README.org b/README.org
index 03a6ede..f223076 100644
--- a/README.org
+++ b/README.org
@@ -1,19 +1,22 @@
-* cleberg.net
-
-[[https://cleberg.net][cleberg.net]] is my personal webpage and blog.
+#+title: README
 
-** Overview
+* cleberg.net
 
-This website & blog uses [[https://orgmode.org/][Org-Mode]], published with [[https://github.com/emacs-love/weblorg][weblorg]].
+[[https://cleberg.net][cleberg.net]] is my personal webpage and blog. This website and blog utilize the
+powerful Org-Mode publishing system, courtesy of the [[https://github.com/emacs-love/weblorg][weblorg]] Emacs package.
 
-** Configuration
+** Features & Configuration
 
-All configuration options are available within the =publish.el= file. Refer to
-the weblorg documentation for further configuration options.
+This site leverages the flexibility of Org-Mode to allow for easy customization
+through a simple =publish.el= file. For those who are interested in tweaking the
+underlying configuration, the weblorg documentation provides all necessary
+details on possible settings and options.
 
-** Building & Publishing
+** Getting Started with cleberg.net
 
-Local testing is available via [[https://www.gnu.org/software/emacs/][Emacs]] or through the command line.
+To begin exploring or contributing to this project, you'll first need to set up
+a local copy of the repository. This can be accomplished by running the
+following commands within Emacs:
 
 #+begin_src sh
 git clone https://git.cleberg.net/cleberg.net.git && \
@@ -21,32 +24,44 @@ cd cleberg.net && \
 emacs -nw
 #+end_src
 
-Within Emacs, open any of the repository files. In Doom, I do this with =Spc f
-f= and selecting =README.org=. Make any changes necessary to customize the
-project.
+#+RESULTS:
+
+Alternatively, if you prefer working with Doom, simply open any of the
+repository files using =Spc f f= and selecting =README.org=. From there, feel
+free to make any necessary changes or customizations.
 
-To publish, you can use the =build.sh= script (change the deployment target!) or
-you can run the following commands.
+** Building & Publishing the Site
+
+To test the site locally within Emacs, run the following command sequence:
 
 Use the =ENV= environment variable to determine which base URL weblorg will use.
-If ENV is ommitted, it will default to =localhost:8000=. If =ENV=prod=, weblorg
+If ENV is omitted, it will default to =localhost:8000=. If =ENV=prod=, weblorg
 will look in the =publish.el= file for the production base URL.
 
 #+begin_src sh
 ENV=prod emacs --script publish.el
 #+end_src
 
-The files will be published to the =.build= directory. You can deploy these
-files to the target through any number of methods, such as =scp= or SFTP.
+The resulting files can then be deployed to your desired target using any method
+of your choice, such as =scp= or SFTP.
+
+Alternatively, you may prefer to utilize the provided =build.sh= script to
+automate this process. To do so, simply customize and run the script as needed.
+
+*** Creating New Blog Posts
 
-Alternatively, customize and run the =build.sh= script as needed.
+To quickly create a new blog post within Emacs, follow these steps:
 
-*** Tips
+1. Run =C-x C-f= (=SPC f f= in Doom) to open a new Org-Mode file.
+2. Utilize the =insert-file-contents= command by pressing =C-x i=.
+3. Direct the contents of =template.org= (located at =utils/template.org=) into
+   the newly opened file.
 
-You can quickly create a new blog post by running =C-x C-f= (=SPC f f= in Doom),
-running =C-x i= (=insert-file-contents=), and then direct it to the
-=template.org= file (e.g., =~/git/cleberg.net/utils/template.org=).
+This streamlined process allows you to rapidly generate fresh content for
+cleberg.net, taking advantage of the existing template structure and formatting.
 
-** Tasks
+** Contributing & Tasks
 
-Refer to the [[https://github.com/ccleberg/cleberg.net/issues][issues page]] for open tickets or to submit a new ticket.
+For those interested in contributing to this project or addressing any
+outstanding issues, please refer to the [[https://github.com/ccleberg/cleberg.net/issues][issues page]]. This is where you can find
+a comprehensive list of open tickets or submit a new ticket for consideration.
diff --git a/utils/salary_visualization.py b/utils/salary_visualization.py
index 311e3c2..2a826b5 100644
--- a/utils/salary_visualization.py
+++ b/utils/salary_visualization.py
@@ -1,19 +1,29 @@
 """
 A file that will visualize salary data from an incoming CSV.
+
+This script reads a CSV file containing salary data and visualizes it using
+plotly.
 """
 
 import locale
+from pandas import read_csv as pd_read_csv
 import pandas as pd
 import plotly.graph_objs as go
 
 locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
 
-df = pd.read_csv('~/git/cleberg.net/static/salary.csv')
+# Read the CSV file
+df = pd_read_csv('~/git/cleberg.net/theme/static/salary.csv')
 
-# Function to format salary as US currency
-def format_currency(value):
+def format_currency(value: float) -> str:
     """
     Format values in USD currency format.
+
+    Args:
+        value (float): The value to be formatted.
+
+    Returns:
+        str: The formatted value.
     """
     return f"${value:,.2f}"
 
@@ -23,25 +33,37 @@ df = df.iloc[::-1].reset_index(drop=True)
 # Calculate the percentage increase
 df['Percentage Increase'] = df['Salary'].pct_change() * 100
 
-# Initialize the plot
-fig = go.Figure()
+def create_trace(row: pd.Series) -> go.Scatter:
+    """
+    Create a scatter plot trace for a single row.
 
-# Adding each data point as a separate trace to display the text
-for index, row in df.iterrows():
-    TITLE_COMPANY = f"{row['Title']} ({row['Company']})"
+    Args:
+        row (pd.Series): The row to be plotted.
+
+    Returns:
+        go.Scatter: The created scatter plot trace.
+    """
+    title_company = f"{row['Title']} ({row['Company']})"
     salary_formatted = format_currency(row['Salary'])
     if pd.notna(row['Percentage Increase']):
         text = f"{salary_formatted} ({row['Percentage Increase']:.2f}%)"
     else:
         text = salary_formatted
-    fig.add_trace(go.Scatter(
+    return go.Scatter(
         x=[row['Start'], row['End']],
         y=[row['Salary'], row['Salary']],
         text=[text],
         mode='lines+text',
-        name=TITLE_COMPANY,
+        name=title_company,
         textposition='top center'
-    ))
+    )
+
+# Initialize the plot
+fig = go.Figure()
+
+# Add each data point as a separate trace to display the text
+for index, row in df.iterrows():
+    fig.add_trace(create_trace(row))
 
 # Update visual styles of the figure
 fig.update_layout(
@@ -60,4 +82,5 @@ fig.update_layout(
     height=800
 )
 
+# Display the plot
 fig.show()