Skip to content

Instantly share code, notes, and snippets.

SELECT
p.ID as order_id,
p.post_date,
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as Email,
max( CASE WHEN pm.meta_key = '_shipping_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as 'First Name',
max( CASE WHEN pm.meta_key = '_shipping_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as 'Last Name',
max( CASE WHEN pm.meta_key = '_shipping_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as 'Default Address Address1',
max( CASE WHEN pm.meta_key = '_shipping_address_2' and p.ID = pm.post_id THEN pm.meta_value END ) as 'Default Address Address2',
max( CASE WHEN pm.meta_key = '_shipping_city' and p.ID = pm.post_id THEN pm.meta_value END ) as 'Default Address City',
max( CASE WHEN pm.meta_key = '_shipping_state' and p.ID = pm.post_id THEN pm.meta_value END ) as 'Default Address Province Code',
@chongkan
chongkan / AccHelper.js
Created April 23, 2024 13:53
Solana Create Nonce Account
import {
Keypair,
NONCE_ACCOUNT_LENGTH,
SystemProgram,
TransactionMessage,
VersionedTransaction
} from "@solana/web3.js";
class AccHelper {
/**
@chongkan
chongkan / sol-did.js
Last active March 30, 2024 04:55
Generates a DID identifier using the owner's public key, method, and program ID.
/**
* Generates a DID identifier using the owner's public key, method, and program ID.
* @param {string} authorityPublicKey - The owner's public key.
* @returns {string} - The generated DID identifier.
* https://g.identity.com/sol-did/#identifier-generation-method
*/
import bs58 from 'bs58';
async function generateDIDIdentifier(authorityPublicKey) {
let seed = 256;
@chongkan
chongkan / PasswordStrength.vue
Last active February 9, 2024 03:20
Real-Time Feedback on Password Strength
<template>
<div>
<label for="password">Enter Password:</label>
<input type="password" id="password" v-model="password" @input="checkPassword">
<div v-if="password">
<p>Password Strength: {{ strength }}</p>
<div :class="['strength-meter', 'level-' + strengthLevel]"></div>
</div>
</div>
</template>
@chongkan
chongkan / CRCD-Metadata.json
Created November 27, 2023 08:41
CRCD - Costa Rica CRC Digital
{
"name": "Costa Rica CRC Digital",
"symbol": "CRCD",
"description": "Digital CRC backed by fiat CRC 1:1 - Stable",
"image": "https://node1.irys.xyz/-fvLT_p5So8HgBMpbKnZGYL7LaEzLAI01eX3eGAFVtE"
}
@chongkan
chongkan / constants
Created July 21, 2023 11:24 — forked from adrianhajdin/constants
Build and Deploy a Web3 Crowdfunding Platform (Kickstarter) As Your First Blockchain Application
import { createCampaign, dashboard, logout, payment, profile, withdraw } from '../assets';
export const navlinks = [
{
name: 'dashboard',
imgUrl: dashboard,
link: '/',
},
{
name: 'campaign',
@chongkan
chongkan / Smart Contract - Solidity - 7 Vulnerabilities.sol
Last active July 6, 2023 21:10
Smart Contract - Solidity - 7 Vulnerabilities.
// Top 8 Scary Smart Contract Hacks They Use to Exploit Your DApp [+Video]
// https://blog.finxter.com/top-8-scary-smart-contract-hacks-that-exploit-your-dapp-video/
/*
Ownership Exploit
Private Variable Exploit
Reentrancy Attack
tx.origin Phishing Attack
Denial of Service Attack
@chongkan
chongkan / CCR.md
Last active June 30, 2023 14:24
CONTRATO DE CERTIDUMBRE RELACIONAL

CONTRATO DE CERTIDUMBRE RELACIONAL


Fecha: [Fecha actual]

Entre:

Parte A: [Tu nombre] Parte B: [Nombre de la 2da Parte]

@chongkan
chongkan / Dockerfile.backend
Last active June 28, 2023 06:45
Backend + Frontend Dockerfile for Python/Django Development + Node.js/React Development
FROM python:3.9
WORKDIR /app/backend
COPY backend/requirements.txt .
RUN pip install -r requirements.txt
COPY backend/ .
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
@chongkan
chongkan / gist:7f884c6602d9a124a1314c5270f7db9c
Last active August 12, 2022 22:43
This is how SWIFT used to be - JSON
{
"uetr": "684ff44e-1357-4926-b5d8-278ffde2f11a",
"transaction_status": "ACCC",
"initiation_date_time": "2022-08-12T22:42:39.0Z",
"completion_date_time": "2022-08-12T22:43:31.0Z",
"last_update_date_time": "2022-08-12T22:43:31.0Z",
"payment_event": [
{
"network_reference": "220812GRWLCNSHXXXA9214793636",
"message_name_identification": "103",