Skip to content

Instantly share code, notes, and snippets.

View MuyembeII's full-sized avatar
🎯
Focusing

GMuyembe Jr MuyembeII

🎯
Focusing
  • Chilanga
View GitHub Profile
@MuyembeII
MuyembeII / mysql_procedure_loop_ids_and_insert.sql
Created October 20, 2023 23:15 — forked from wturnerharris/mysql_procedure_loop_ids_and_insert.sql
Here's a mysql stored procedure to loop through the results of a select query that returns ids and performs an additional operation on each id.
DROP PROCEDURE IF EXISTS migrateById;
DELIMITER $$
CREATE PROCEDURE migrateById()
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE _post_id INT;
DECLARE migrate_ids CURSOR FOR
# modify the select statement to returns IDs, which will be assigned the variable `_post_id`
@MuyembeII
MuyembeII / UserDto.ts
Created September 24, 2022 18:06
Nest JS Typescript DTO Helper
export class UserDto {
@IsNotEmpty() id: string;
@IsNotEmpty() username: string;
@IsNotEmpty() @IsEmail() email: string;
}
@MuyembeII
MuyembeII / KotlinDataDeserializer.kt
Created May 11, 2021 17:54 — forked from kilink/KotlinDataDeserializer.kt
Kotlin data class deserializer
@JsonDeserialize(using = KotlinDataDeserializer::class)
data class Foo(val x: String, val y: String, val z: Int)
class KotlinDataDeserializer : StdDeserializer<Foo>(Foo::class.java) {
override fun deserialize(p: JsonParser, ctxt: DeserializationContext): Foo {
return p.readValueAs(Foo::class.java)
}
override fun deserialize(p: JsonParser, ctxt: DeserializationContext, intoValue: Foo): Foo {
val copy = intoValue::copy