Skip to content

Instantly share code, notes, and snippets.

View dalegaspi's full-sized avatar
🎓
BU S2 2022

Dexter Legaspi dalegaspi

🎓
BU S2 2022
View GitHub Profile
@dalegaspi
dalegaspi / WireMockConfigurations.java
Last active December 29, 2022 19:51
WireMock with Maven, Reflection, and Clojure
package com.acme;
import clojure.java.api.Clojure;
import clojure.lang.IFn;
import clojure.lang.ISeq;
import clojure.lang.SeqIterator;
import io.vavr.control.Either;
import io.vavr.control.Try;
import lombok.extern.slf4j.Slf4j;
@dalegaspi
dalegaspi / AndroidManifest.xml
Last active July 16, 2022 12:39
Flickr OAuth 1.0a Authentication with Flickr4J and Scribe
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.bu.cs683.myflickr">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
@dalegaspi
dalegaspi / AppFx.java
Last active February 23, 2022 13:15
Creating a Splash Screen with JavaFx
package my.app;
import com.google.inject.Guice;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
@dalegaspi
dalegaspi / flask_redis.py
Created June 16, 2021 23:22
Flask Redis PUT/GET Endpoints
r = redis.Redis(host='localhost', port=6379, db=0, decode_responses=True)
@app.route('/api/guestbook/message', methods=['POST', 'PUT'])
def api_put_message():
form_data = request.form
id = str(uuid.uuid4())
data = {
'ts': round(time.time() * 1000),
'id': id,
'email': form_data['email'],
@dalegaspi
dalegaspi / vue_vs_react.md
Last active June 14, 2021 02:16
Vue vs React 2021

For me, the better choice Vue.js regardless of size of the project. And this can be explained succintly with three simple words: Two Way Binding.

When I began using JavaScript frameworks for dynamic UI, I started with the original AngularJS. It is the original framework that elegantly implemented two-way binding in an MVVM framework, where a model is bound to an element/elements. The original implementation didn't scale as well (i.e., there is severe page performance as you add more and more two-way bindings), but this was actually mitigated (to an extent) by the introduction of one-way binding construct in v1.5.

If this feature is so great, why do some developers hate it and even calling it anti-pattern? A few reasons I could think of, actually.

  • While VueJS (and the newer Angular 2.x) has addressed the performance issues plagued by two-way bindings in Angular 1.x, there is a tende
@dalegaspi
dalegaspi / es6_arrow_functions.md
Last active June 8, 2021 17:04
Arrow Functions and the Road to Declarative Programming

Arrow Functions and the Road to Declarative Programming

Consider this data:

let tbl_hs_students = {
  headers: [
    "First Name",
    "Year",
    "House",
@dalegaspi
dalegaspi / install_py_3_centos7.md
Created June 1, 2021 21:43
How to Install Python 3 on Centos 7

How to Install Python 3 on Centos 7

  1. yum -y update
  2. yum install -y python3

you now have python3.

@dalegaspi
dalegaspi / ConvertHttpMethodFilter.java
Created April 22, 2021 23:11
Custom Spring Cloud Gateway to change HTTP Method In Flight
package yeet;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
@dalegaspi
dalegaspi / DynamicPostTransformFilter.java
Last active August 28, 2023 04:32
Spring Cloud Gateway Response Modification
package yeet;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.util.Strings;
import org.reactivestreams.Publisher;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.NettyWriteResponseFilter;
import org.springframework.cloud.gateway.filter.OrderedGatewayFilter;
import org.springframework.cloud.gateway.filter.factory.rewrite.CachedBodyOutputMessage;
import org.springframework.cloud.gateway.filter.factory.rewrite.MessageBodyDecoder;
@dalegaspi
dalegaspi / windows_10_boot_loop.md
Created June 15, 2020 14:21
Windows 10 Preparing Automatic Repair Infinite Loop Issue

This issue has happened to me recently and this happened after i rearranged the cables on my custom PC to make it look cleaner.

Windows will just get stuck into the spinning dots and after 2 hard reboots it will go into the "Prepare Automatic Repair" then goes blank not able to boots successfully and will not even go into Safe/Repair mode.

Trying to boot Windows via USB is also successful. Windows Installer will start really slow but eventually gets stuck in starting the actual install. Selecting the PC Repair option leaves you in this state.

After a couple of hours troubleshooting, it turns out that the cable to one of the secondary SATA drives (NVMe is used as primary drive) isn't plugged in completely (most likely got dislodged while I was rearranging the cable as it's only held on by friction). Once i plug it in again, Windows has booted up successfully.

**TLDR: Windows 10 won't boot when one of the secondary SATA drives isn't plugged in correctly...make sure all SATA drives are plugged in pro