Skip to content

Instantly share code, notes, and snippets.

View jpalala's full-sized avatar
🎯
Focusing

Joe Palala jpalala

🎯
Focusing
View GitHub Profile
@jpalala
jpalala / rsync-up.sh
Created February 8, 2025 09:04
rsync from a file config
#!/bin/bash
# config file looks like:
## ```
# source=$PWD
# dest=/path/to/folder
### ```
# Check if .rsync file exists
CONFIG_FILE=".rsync"
if [[ ! -f "$CONFIG_FILE" ]]; then
@jpalala
jpalala / fetch todos.md
Created February 7, 2025 02:39
Fetching todos from a notion database guide

To fetch todos from a Notion database list using the Notion API, you'll need to follow these steps:

  1. Create a Notion integration to get an API key
  2. Share your database with the integration
  3. Use the "Query a database" endpoint to fetch the list of tasks

Here's a step-by-step guide with code examples:

@jpalala
jpalala / instructions.md
Created January 25, 2025 05:38
poc java lambda writing to s3 file

Upload base64 encoded file to S3

  1. Encrypt the .env file locally (on linux / mac):
    base64 your-env-file.env > encrypted-env-file.env
  2. Upload the encrypted-env-file.env to S3 (via aws-cli)

Notes for Production

@jpalala
jpalala / poc_feature_flag_loader_from_file.php
Last active January 25, 2025 03:21
launch iterably wip
<?php
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Config;
// get data from an api that uses basic auth then decode it as a .env file
function get_features($url, $creds, $segment = []) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', $additionalHeaders));
@jpalala
jpalala / readme.md
Last active December 26, 2024 10:33
docker hints

To show only running containers use the given command:

  docker ps

To show all containers use the given command:

 docker ps -a
@jpalala
jpalala / enough.scss
Created December 24, 2024 09:39
Sassy Enough.CSS
body {
font: 22px/1.6 system-ui,sans-serif;
margin: auto;
max-width: 35em;
padding: 0 1em;
}
img, video {
max-width: 100%;
height: auto;
@jpalala
jpalala / add_tags.md
Created November 17, 2024 09:52
add tags to post

Yes, you can add tags to blog posts by creating a many-to-many relationship between posts and tags. This requires three tables:

  1. posts: Table to store blog posts.
  2. tags: Table to store tags.
  3. post_tag: Pivot table to associate posts with tags.

Migration Code

@jpalala
jpalala / how-to-track-unique-clicks-using-jquery.md
Created October 1, 2024 01:27
how to track unique clicks using jquery

Note: From ChatGPT. Thank you ChatGPT!

To implement click tracking with jQuery and store it in a backend API, we can outline the following steps:

1. Database Schema

You can use a database table to store unique clicks, capturing the necessary details like the browser, IP address, and clicked_at timestamp.

SQL for the table:

@jpalala
jpalala / meetups.json
Created September 11, 2024 06:38
JSON example meetups api from friendsofphp.org
{
"generated_at": "2024-09-11 00:27:52",
"meetups": [
{
"name": "Why you should consider Drupal for your next project",
"user_group_name": "#pugMi: PHP User Group Milano",
"local_date": "2024-09-11",
"local_time": "17:00",
"utc_start_date_time": "1726074000",
"city": "Milano",
@jpalala
jpalala / README.md
Created August 26, 2024 01:47
Docker run jekyll

Setting up a Jekyll environment with Docker can streamline your development process, especially if you're looking to maintain consistency across different environments. Below, I'll guide you through creating a working Jekyll Docker environment using the official Jekyll Docker image.

Step-by-Step Guide

1. Create a Dockerfile

First, create a Dockerfile to define your Jekyll environment. Create a file named Dockerfile in your project directory with the following content:

# Use the official Jekyll image