{
    "version": "https://jsonfeed.org/version/1.1",
    "title": "https://www.czepeda.com \u2014 Posts / Projects",
    "home_page_url": "https://czepeda.com",
    "feed_url": "https://czepeda.com/posts/tags/projects",    
    "description": "Projects - Web development work I'm doing for clients, or for myself.\n",
    "authors": { 
        "name": "Carlos Alberto Zepeda",
        "url": "https://czepeda.com"
    },
    "language": "en-US",
        "items": [
    
        
                {
"id": "https://www.czepeda.com/posts/messenger-utrgv-edu-redesign",
"url": "https://www.czepeda.com/posts/messenger-utrgv-edu-redesign",
"title": "messenger.utrgv.edu redesign",
"content_html": "<p>Early 2023 I redesigned the universities events web application and university email called Messenger. This is the daily campus distributed email. Faculty, students and staff recieve this email every morning. The goal is to inform everyone of the university related events going on around campus.<\/p>\n<p>I worked with marketing department who provided the initial drafts of the desktop and email designs of Messenger. My job was to implement those designs into our web application. The web application used Angular to build out the website and email template. I wrote the CSS and HTML into the Angular template. This template would build out to the web application. The other Angular template build was for the email that gets sent to all university faculty, students and staff inboxes. I also write the HTML and CSS for that template.<\/p>\n<p>Other work I provided was helping troubleshoot some logic in Angular to detect the state of the user type in order to output the correct data depending if the user was a faculty member, student or staff.<\/p>\n<p>Related announcements regarding the new UTRGV Messenger.<\/p>\n<ul>\n<li><a href=\"https:\/\/messenger.utrgv.edu\/#\/bulletin\/56334\">Introducing: Messenger 2.0!<\/a><\/li>\n<li><a href=\"https:\/\/messenger.utrgv.edu\/#\/bulletin\/56332\">COMING SOON: A Whole NEW Messenger Experience!<\/a><\/li>\n<\/ul>\n",
"date_published": "Wed, 31 Jan 2024 11:58:00 +0000",
"tags": "Projects"
},
        
                {
"id": "https://www.czepeda.com/posts/utrgv-parking-spaces-available-widget",
"url": "https://www.czepeda.com/posts/utrgv-parking-spaces-available-widget",
"title": "UTRGV Parking Spaces Available Widget",
"content_html": "<p>This was a fun project that brought a lot of relief to students looking for parking spots in the different parking lots around the UTRGV campus. I worked with the Parking department to find a solution using the hardware data they had installed in the parking lots.<\/p>\n<p>My coworker Chris converted that data into a JSON endpoint that I could then use with the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Fetch_API\/Using_Fetch\">fetch API<\/a>. The fetch API is the modern replacement of XMLHttpRequest. No framework was needed for this. I wrote plain JavaScript. Fetch API is pretty simple to work with. The CSS and HTML was also plain and simple. No need to get fancy. Of course it was responsive. The department wanted to place the widgets all over their website and on the universities iOS and Android applications.<\/p>\n<p>First I made the request to store the JSON data into <code>getLots()<\/code>. Also note that the fetch API is promise-based. This gives us the flexibility to present the completion of the operation or failure and how to handle each.<\/p>\n<pre><code>async function getLots() {\n    let url = '...\/api\/parking';\n    try {\n        let response = await fetch(url);\n        return await response.json();\n    } catch (error) {\n        console.log(error);\n    }\n}\n<\/code><\/pre>\n<p>Then its formating the JSON data into HTML. I made use of template literals to make it easier to write the HTML as I normally would and insert the expressions in their respective places.<\/p>\n<pre><code>async function renderLots() {\n  let parkingLots = await getLots();\n  let html = '';\n\n\tparkingLots.forEach(parkingLot =&gt; {\n    \n    const lots = `\n    \t\t&lt;div class=&quot;parking_lot ${parkingLot.location_name}&quot;&gt;\n            \t&lt;div&gt;${parkingLot.location_name} - Zone #&lt;\/div&gt;\n                &lt;div&gt;${parkingLot.location_addres}&lt;\/div&gt;\n                &lt;div&gt;${parkingLot.total_spaces}&lt;\/div&gt;\n                ... \/\/ grab the rest of the items.\n          \t&lt;\/div&gt;\n            `;\n            html += lots;\n    const container = document.querySelector('.parkingWidget');\n    container.innnerHTML = html;\n    }\n  )}\n    renderLots();       \n<\/code><\/pre>\n<p>Finally the HTML selector to insert the parking spaces into.<\/p>\n<pre><code>&lt;div class=&quot;parkingWidget&quot;&gt;...&lt;\/div&gt;\n<\/code><\/pre>\n",
"date_published": "Sat, 03 Feb 2024 00:36:07 +0000",
"tags": "Projects, javascript"
},
        
                {
"id": "https://www.czepeda.com/posts/json-to-yaml-to-markdown-file-shell-script",
"url": "https://www.czepeda.com/posts/json-to-yaml-to-markdown-file-shell-script",
"title": "JSON to YAML to Markdown file Shell Script",
"content_html": "<p>I currently have a <a href=\"https:\/\/pinboard.in\/u:cazepeda\">pinboard.in<\/a> account which will expire soon. I've had that account since the formation of pinboard back in 2008. It's been a great service but now that I've got my website going again. I thought I'd start importing all those bookmarks into my website.<\/p>\n<p>Pinboard.in provides exporting the bookmarks in JSON, XML and HTML. If I want to import it into Statamic I'd need to convert that JSON data into YAML data and then make that document into Markdown. Luckily, JSON and YAML save their data in a key\/value pair structure, e.g. <code>key: value<\/code>. For me this was a plus because my first thought was create a shell script to convert each JSON object into a separate YAML\/Markdown file. Each Pinboard.in bookmark is saved into it a JSON object like so.<\/p>\n<pre><code>[\n    {\n        &quot;href&quot;: &quot;https:\\\/\\\/teamrv-mvp.sos.texas.gov\\\/MVP\\\/back2HomePage.do&quot;,\n        &quot;description&quot;: &quot;My Voter Portal&quot;,\n        &quot;extended&quot;: &quot;&quot;,\n        &quot;meta&quot;: &quot;f37ee28f61e35f5db09c653a4d3c82ac&quot;,\n        &quot;hash&quot;: &quot;99aba043d80c1b0765802fd7e6284a86&quot;,\n        &quot;time&quot;: &quot;2024-01-31T16:18:56Z&quot;,\n        &quot;shared&quot;: &quot;yes&quot;,\n        &quot;toread&quot;: &quot;no&quot;,\n        &quot;tags&quot;: &quot;texas voting&quot;\n    },\n    {\n        &quot;href&quot;: &quot;https:\\\/\\\/publicdomainreview.org\\\/collection\\\/flammarion-engraving\\\/&quot;,\n        &quot;description&quot;: &quot;Wheels Within Wheels: The \\u201cFlammarion Engraving\\u201d (ca. 1888) \\u2013 The Public Domain Review&quot;,\n        &quot;extended&quot;: &quot;&quot;,\n        &quot;meta&quot;: &quot;4b9ed2dd7330962794ca45fe901fba72&quot;,\n        &quot;hash&quot;: &quot;b864adf2c9eb1f92ba1ad8aa43b23d8e&quot;,\n        &quot;time&quot;: &quot;2024-01-30T06:22:42Z&quot;,\n        &quot;shared&quot;: &quot;yes&quot;,\n        &quot;toread&quot;: &quot;no&quot;,\n        &quot;tags&quot;: &quot;art history&quot;\n    },\n    {\n        &quot;href&quot;: &quot;https:\\\/\\\/www.contemporist.com\\\/an-exterior-of-vertical-wood-siding-helps-this-house-blend-into-the-surrounding-forest\\\/&quot;,\n        &quot;description&quot;: &quot;An Exterior Of Vertical Wood Siding Helps This House Blend Into The Surrounding Forest&quot;,\n        &quot;extended&quot;: &quot;&quot;,\n        &quot;meta&quot;: &quot;188364b64f99012a1ab86a4901bb2452&quot;,\n        &quot;hash&quot;: &quot;b3e724498141b8426c05ae0933b98520&quot;,\n        &quot;time&quot;: &quot;2024-01-26T15:21:10Z&quot;,\n        &quot;shared&quot;: &quot;yes&quot;,\n        &quot;toread&quot;: &quot;no&quot;,\n        &quot;tags&quot;: &quot;home&quot;\n    }\n]\n<\/code><\/pre>\n<p>First thing I tackled was extracting each object from JSON and convert it to a Markdown file. I'm using <a href=\"https:\/\/jqlang.github.io\/jq\/\">jq command-line JSON processor<\/a> to format the data as needed. This part of the script checks first if jq is installed, find the <code>.json<\/code> file to work with, create a directory to create the markdown files into, use the <code>.time<\/code> and <code>.description<\/code> key property to use for naming the markdown file. I also had to format the JSON key\/value pair into a YAML structure. This was easy enough with exception to the <code>tags<\/code> property to list the <code>value<\/code>'s in a listed structure. I tackled this in the second part of the shell script. Originally I created all these parts of the shell script in separate scripts in order to keep testing simple and easy to manage.<\/p>\n<pre><code>#!\/bin\/bash\n\n# CREATE MARKDOWN FILES FROM JSON\n\n# Check if jq is installed\nif ! command -v jq &amp;&gt; \/dev\/null; then\n    echo &quot;Please install jq before running this script.&quot;\n    exit 1\nfi\n\n# Input JSON file\ninput_json=&quot;\/path\/to\/file\/test.json&quot;\n\n# Output directory for Markdown files\noutput_dir=&quot;output_markdown&quot;\n\n# Create output directory if it doesn't exist\nmkdir -p &quot;$output_dir&quot;\n\n# Extract each object from JSON and convert to Markdown\njq -c '.[]' &quot;$input_json&quot; | while read -r obj; do\n    # Generate a unique filename based on some property of the JSON object\n    # filename=&quot;$output_dir\/$(echo &quot;$obj&quot; | jq -r '&quot;\\(.time).\\(.description)&quot;').md&quot;\n    filename=&quot;$output_dir\/$(echo &quot;$obj&quot; | jq -r '&quot;\\(.time|tostring|fromdate|strftime(&quot;%Y-%m-%d&quot;)).\\(.description | ascii_downcase | gsub(&quot;\\&quot;&quot;; &quot;\\&quot;&quot;))&quot; | gsub(&quot; &quot;; &quot;-&quot;) | gsub(&quot;\\\\(&quot;; &quot;&quot;) | gsub(&quot;\\\\)&quot;; &quot;&quot;) | gsub(&quot;\\\\\\&quot;&quot;; &quot;&quot;) | gsub(&quot;\u201c&quot;; &quot;&quot;) | gsub(&quot;\u201d&quot;; &quot;&quot;) | gsub(&quot;:&quot;; &quot;&quot;)').md&quot;\n    \n    # Convert JSON object to Markdown and save it to the file\n    echo -e &quot;$obj&quot; | jq -r '[&quot;---&quot;] + (to_entries | map(&quot;\\(.key): \\(.value)&quot;)) + [&quot;---&quot;] | join(&quot;\\n&quot;)' &gt; &quot;$filename&quot;\n\n    echo &quot;Converted and saved to: $filename&quot;\ndone\n\n# END CREATE MARKDOWN FILES FROM JSON\n<\/code><\/pre>\n<p>This is the shell script that handled converting the <code>tags<\/code> property <code>value<\/code>'s to be listed. The reason I needed it to be listed was because in Statamic creates an index page listing all posts related to <code>history<\/code> or any tag that gets created out of the <code>tags<\/code> key property <code>value<\/code>.<\/p>\n<p>This part of the script will create a variable for the directory where all the markdown files got created. Create a variable for a space that will be used to detect the different tags values. Check if the directory exists. Then go through each markdown file and format it in a YAML structure. It will detect the <code>tags<\/code> key property and detect the <code>value<\/code>s and list them.<\/p>\n<pre><code># FORMAT MARKDOWN FILES\n\n# Directory containing Markdown files\ndirectory=&quot;\/path\/to\/directory\/output_markdown&quot;\n\n# Separator used in the tags field\ntags_separator=&quot; &quot;\n\n# Check if the directory exists\nif [ ! -d &quot;$directory&quot; ]; then\n    echo &quot;Directory not found: $directory&quot;\n    exit 1\nfi\n\n# Process each Markdown file in the directory\nfor file in &quot;$directory&quot;\/*.md; do\n    # Check if the file is a regular file\n    if [ -f &quot;$file&quot; ]; then\n        # Process the Markdown file and create a temporary file\n        temp_file=$(mktemp)\n        awk -v sep=&quot;$tags_separator&quot; -F': ' '            \n            $1 == &quot;tags&quot; {\n                # Convert the values into a list format\n                printf &quot;%s:\\n&quot;, $1\n                n = split($2, tags, sep)\n                for (i = 1; i &lt;= n; i++) {\n                    printf &quot; - %s\\n&quot;, tags[i]\n                }\n            }\n            $1 != &quot;tags&quot; {            \n                # For other lines, print as is\n                print\n            }\n        ' &quot;$file&quot; &gt; &quot;$temp_file&quot;\n\n        # Replace the original file with the updated content\n        mv &quot;$temp_file&quot; &quot;$file&quot;\n        echo &quot;Updated: $file&quot;\n    fi\ndone\n\n# END FORMAT MARKDOWN FILES\n<\/code><\/pre>\n<p>Final part of this shell script was optional. But I wanted to wrap specific <code>key<\/code> property <code>value<\/code>s in single quotes. First I define what values I want to target. Created a directory variable to locate the markdown files. Loop through the <code>key<\/code>'s and append the single quotes to the <code>value<\/code>'s that are specified in the <code>target_keys<\/code> variable.<\/p>\n<pre><code># ADD SINGLE TICKS TO SPECIFIED KEYS\n\n# Specify the keys for which values should be enclosed in single quotes\ntarget_keys=(&quot;href&quot; &quot;description&quot; &quot;time&quot;)\n\n# Directory containing Markdown-like files\ndirectory=&quot;\/path\/to\/directory\/output_markdown&quot;\n\n# Loop through each file in the directory\nfor file in &quot;$directory&quot;\/*.md; do\n    # Check if the file is a regular file\n    if [ -f &quot;$file&quot; ]; then\n        # Loop through target keys and add single quotes around values\n        for key in &quot;${target_keys[@]}&quot;; do\n            sed -E &quot;s\/^$key: (.*)$\/$key: '\\1'\/&quot; &quot;$file&quot; &gt; &quot;$file.temp&quot;\n            mv &quot;$file.temp&quot; &quot;$file&quot;\n        done\n\n        echo &quot;Single quotes added to specified keys in: $file&quot;\n    fi\ndone\n\necho &quot;Update complete.&quot;\n\n# END ADD SINGLE TICKS TO SPECIFIED KEYS\n<\/code><\/pre>\n<p>Last thing to do as you should with all shell scripts that you run, make it writeable! Do this by running the following code: <code>chmod +x json-to-yaml-to-markdown-file.sh<\/code>. You can check that is wrote the command as specified by running the following command to show the file permissions, you'll know its writeable by the <code>x<\/code> a the last part of the permissions: <code>ls -la<\/code>. e.g. <code>-rwxr-xr-x  1 computerName  staff 996 Feb 7 12:58 json-to-yaml-to-markdown-file.sh<\/code>.<\/p>\n<p>Once its writeable, run the script and watch the magic happen: <code>.\/json-to-yaml-to-markdown-file.sh<\/code>.<\/p>\n",
"date_published": "Fri, 09 Feb 2024 01:43:16 +0000",
"tags": "Projects, blog"
}
                
        
    ]
}