Skip to content

Instantly share code, notes, and snippets.

@1UC1F3R616
Last active July 26, 2024 11:55
Show Gist options
  • Save 1UC1F3R616/232f0298c80f04102c93f7cf3afa7172 to your computer and use it in GitHub Desktop.
Save 1UC1F3R616/232f0298c80f04102c93f7cf3afa7172 to your computer and use it in GitHub Desktop.
scrape-book

Must be one of the following:

feat: A new feature. fix: A bug fix. docs: Documentation only changes. style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc). refactor: A code change that neither fixes a bug nor adds a feature. perf: A code change that improves performance. test: Adding missing tests. chore: Changes to the build process or auxiliary tools and libraries such as documentation generation.

Initial commit 🎉 🎉

New feature ✨ ✨

Bugfix 🐛 🐛

Documentation 📚 📚

Performance 🐎 🐎

Tests 🚨 🚨

Refactor code 🔨 🔨

Removing code/files 🔥 🔥

Adding CI build system 👷 👷

Security 🔒 🔒

Upgrading dependencies ⬆️ ⬆️

Downgrading dependencies ⬇️ ⬇️

Critical hotfix 🚑 🚑

Work in progress 🚧 🚧

Lint 👕 👕

Configuration files 🔧 🔧

@1UC1F3R616
Copy link
Author

What if you took all the worst part of, like, managing a code base, infrastructure around and make sure that things that are supposed to actually work together smoothly are bokren up into as many desperate parts and rather than ship one version of React you can ship 42 different verisons of react that are all loaded from different CDNs. What if we did that so two teams don't have to talk to each other or possibly have to collaborate on same codebase

@1UC1F3R616
Copy link
Author

Increased Complexity: Breaking down a monolithic frontend introduces complexity in development and maintenance due to managing multiple codebases and dependencies.

Inter-Component Communication Overhead: Ensuring seamless communication between micro frontends adds complexity and can impact performance.

@1UC1F3R616
Copy link
Author

What if we split our codebase into tiny pieces, shipped 42 React versions from different CDNs, What if we did that so two teams don't have to talk to each other or, heaven forbid, collaborate on the same codebase? and called it "Micro Frontends"? It's like herding cats, but with code!

What if we took all the worst parts of managing a codebase, made sure everything that's supposed to work smoothly is broken into desperate parts, and instead of shipping one version of React, we shipped 42 different versions all from different CDNs? What if we did that so two teams don't have to talk to each other or, heaven forbid, collaborate on the same codebase? Welcome to Micro Frontends - where chaos meets code! 🤪

@1UC1F3R616
Copy link
Author

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Your Application</title>
  <!-- Matomo Tracking Code -->
  <script type="text/javascript">
    var _paq = _paq || [];
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);
    (function() {
      var u="//your-matomo-domain.com/";
      _paq.push(['setTrackerUrl', u+'matomo.php']);
      _paq.push(['setSiteId', 'YOUR_SITE_ID']);
      var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
      g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
    })();
  </script>
  <!-- End Matomo Tracking Code -->
</head>
<body>
  <div id="tabs">
    <button id="allTasksTab">All Tasks</button>
    <button id="urgentTab">Urgent</button>
    <button id="assignedTab">Assigned to Me</button>
    <button id="unassignedTab">Unassigned</button>
    <button id="sharedTab">Shared with Me</button>
  </div>
  <div id="processTabs">
    <button id="process1">Process 1</button>
    <button id="process2">Process 2</button>
    <!-- Add more process tabs as needed -->
  </div>

  <!-- Counter Display -->
  <div id="clickCounters">
    <p>Tab Click Counters:</p>
    <p id="allTasksCounter">All Tasks: 0</p>
    <p id="urgentCounter">Urgent: 0</p>
    <p id="assignedCounter">Assigned to Me: 0</p>
    <p id="unassignedCounter">Unassigned: 0</p>
    <p id="sharedCounter">Shared with Me: 0</p>
    <p>Process Click Counters:</p>
    <p id="process1Counter">Process 1: 0</p>
    <p id="process2Counter">Process 2: 0</p>
    <!-- Add more process counters as needed -->
  </div>

  <script>
    // Track tab clicks and update counters
    var tabClickCounters = {
      allTasks: 0,
      urgent: 0,
      assigned: 0,
      unassigned: 0,
      shared: 0
    };

    document.getElementById('allTasksTab').addEventListener('click', function() {
      _paq.push(['trackEvent', 'Tabs', 'Click', 'All Tasks']);
      tabClickCounters.allTasks++;
      document.getElementById('allTasksCounter').innerText = "All Tasks: " + tabClickCounters.allTasks;
    });

    document.getElementById('urgentTab').addEventListener('click', function() {
      _paq.push(['trackEvent', 'Tabs', 'Click', 'Urgent']);
      tabClickCounters.urgent++;
      document.getElementById('urgentCounter').innerText = "Urgent: " + tabClickCounters.urgent;
    });

    document.getElementById('assignedTab').addEventListener('click', function() {
      _paq.push(['trackEvent', 'Tabs', 'Click', 'Assigned to Me']);
      tabClickCounters.assigned++;
      document.getElementById('assignedCounter').innerText = "Assigned to Me: " + tabClickCounters.assigned;
    });

    document.getElementById('unassignedTab').addEventListener('click', function() {
      _paq.push(['trackEvent', 'Tabs', 'Click', 'Unassigned']);
      tabClickCounters.unassigned++;
      document.getElementById('unassignedCounter').innerText = "Unassigned: " + tabClickCounters.unassigned;
    });

    document.getElementById('sharedTab').addEventListener('click', function() {
      _paq.push(['trackEvent', 'Tabs', 'Click', 'Shared with Me']);
      tabClickCounters.shared++;
      document.getElementById('sharedCounter').innerText = "Shared with Me: " + tabClickCounters.shared;
    });

    // Track process clicks and update counters
    var processClickCounters = {
      process1: 0,
      process2: 0
      // Add more process counters as needed
    };

    document.getElementById('process1').addEventListener('click', function() {
      _paq.push(['trackEvent', 'Processes', 'Click', 'Process 1']);
      processClickCounters.process1++;
      document.getElementById('process1Counter').innerText = "Process 1: " + processClickCounters.process1;
    });

    document.getElementById('process2').addEventListener('click', function() {
      _paq.push(['trackEvent', 'Processes', 'Click', 'Process 2']);
      processClickCounters.process2++;
      document.getElementById('process2Counter').innerText = "Process 2: " + processClickCounters.process2;
    });
    // Repeat this pattern for other process tabs
  </script>
</body>
</html>

@1UC1F3R616
Copy link
Author

Managed and optimized infrastructure and Backend APIs for a Marketplace serving 4000+ tutors and coaching institutes, ensuring high availability and scalability.

Enhanced database query performance and reliability through the implementation of batch processing in Python and GoLang, resulting in optimized data processing efficiency.

Implemented caching with Redis, substantially reducing the load on the database and enhancing overall performance.

Built an OCR and integrated it with Quiz APIs using Python, GoLang, and AWS Lambda, enhancing the platform's functionality and user experience.

Established Jenkins pipelines to orchestrate automatic builds and deployments within Docker and Kubernetes environments, ensuring seamless continuous integration and delivery workflows.

Leveraged H3 hexagonal grid indexing to meticulously map communities, elevating spatial analysis precision and efficiency.

Seamlessly integrated Mapbox with React for dynamic visualization of geographic regions, enhancing user engagement and navigational clarity.

Employed Mux APIs, using Golang, for seamless video transcoding, dynamically optimizing multimedia content delivery for livestreaming and displaying shorts in both mobile and web applications.

Integrated Amazon S3 for scalable video storage, complemented by a pub-sub mechanism using AWS SNS for efficient notification and processing when adding videos to S3.

Spearheaded the development of k6 load testing strategies and crafted data processing scripts in Python.

Integrated Stripe payment gateway to facilitate secure and efficient online transactions.

Implemented Sentry for real-time error monitoring and proactive issue resolution, ensuring high application reliability.

@1UC1F3R616
Copy link
Author

FROM tomcat:8
WORKDIR /usr/local/tomcat/webapps/
ADD https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war ./sample.war
EXPOSE 8080
CMD ["catalina.sh", "run"]

@1UC1F3R616
Copy link
Author

docker run -itd -p 8080:8080 tomcat:1
curl localhost:8080

@1UC1F3R616
Copy link
Author

@ExtendWith(MockitoExtension.class)
public class NotAllNullParametersValidatorTest {

    @Mock
    private NotAllNullParameters constraintAnnotation;

    @Mock
    private ConstraintValidatorContext context;

    @Mock
    private ConstraintValidatorContext.ConstraintViolationBuilder constraintViolationBuilder;

    private NotAllNullParametersValidator validator;

    @BeforeEach
    public void setup() throws NoSuchFieldException, IllegalAccessException {
        validator = new NotAllNullParametersValidator();
        when(context.buildConstraintViolationWithTemplate(anyString())).thenReturn(constraintViolationBuilder);
        when(constraintViolationBuilder.addConstraintViolation()).thenReturn(context); // Return the context for chaining
        
        // Inject the mocked paramNames to avoid NullPointerException
        String[] paramNames = {"param1", "param2"};
        Field paramNamesField = NotAllNullParametersValidator.class.getDeclaredField("paramNames");
        paramNamesField.setAccessible(true);
        paramNamesField.set(validator, paramNames);

        validator.initialize(constraintAnnotation);
    }

    @Test
    public void testAllNullValues() {
        Object[] values = {null, null};
        assertFalse(validator.isValid(values, context));
    }

    @Test
    public void testNullValuesArray() {
        assertThrows(IllegalArgumentException.class, () -> validator.isValid(null, context));
    }

    @Test
    public void testInvalidValuesLength() {
        Object[] values = {"value1"}; // Less than the number of parameters
        assertThrows(IllegalArgumentException.class, () -> validator.isValid(values, context));
    }

    @Test
    public void testBooleanFalseValue() {
        Object[] values = {false, null};
        assertFalse(validator.isValid(values, context));
    }
    
    @Test
    public void testOneValueNonNull() {
        Object[] values = {"value1", null};
        assertTrue(validator.isValid(values, context));
    }

    @Test
    public void testBooleanTrueValue() {
        Object[] values = {true, null};
        assertTrue(validator.isValid(values, context));
    }

    @Test
    public void testAllNonNullValues() {
        Object[] values = {"value1", 2};
        assertTrue(validator.isValid(values, context));
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment