Skip to content

Instantly share code, notes, and snippets.

View hmboyd's full-sized avatar

Hmboyd hmboyd

View GitHub Profile
@hmboyd
hmboyd / enzyme_render_diffs.md
Created November 23, 2022 22:29 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@hmboyd
hmboyd / CVE-2021-45802.md
Last active February 7, 2022 21:01 — forked from P0cas/CVE-2021-45802.md
MartDevelopers-Inc

CVE-2021-45802

The iResturant is open source for web commercial use. SQL Injection occurs because iResturant does not verify email and phone parameters when registering as a member.

/* (...) */
session_start();
require_once('../config/codeGen.php');
require_once('../config/config.php');
require_once('../partials/head.php');
// Import the sql() function from the backend package file to a web module. We’ll call our web module data.jsw.
import { sql } from '@velo/wix-data-sql-backend';
To get, insert, update, and remove tasks from the to-do list, include the following code in the file:
export async function getAllTasks(visitorId) {
try {
const results = await sql('SELECT _id, title, isComplete FROM MyTasks WHERE visitorId = "' + visitorId + '"');
return results.payload.data.rows;
} catch (error) {
@hmboyd
hmboyd / single.php
Last active January 29, 2022 21:28
1. Open container2. Get posts that this post's category is3. Posts per page4. Display other posts that aren't this post5. For every post in this query, display certain meta info (inside <li>)6. Reset post data
<!-- Custom Related Posts -->
<div class="single_related-posts">
<?php foreach((get_the_category()) as $category) : ?>
<h3>Browse more <?php echo $category->name; endforeach;?></h3>
<ul>
<?php
$related = get_posts( array(
'category__in' => wp_get_post_categories($post->ID),
'posts_per_page' => 6,
ADDRESS:
INSERT INTO new_db.lettings_address(number,street,city,state,zip_code,country_iso_code) SELECT number, street, city, state, zip_code, country_iso_code FROM oc_lettings_site_address;
LETTINGS:
INSERT INTO new_db.lettings_letting(id,title,address_id) SELECT id,title,address_id FROM oc_lettings_site_letting;
USERS:
INSERT INTO new_db.auth_user(id, password, last_login, is_superuser, username, first_name, email, is_staff, is_active, date_joined, last_name) SELECT id, password, last_login, is_superuser, username, first_name, email, is_staff, is_active, date_joined, last_name FROM auth_user;
PROFILES:
INSERT INTO new_db.lettings_letting(id,title,address_id) SELECT id,title,address_id FROM oc_lettings_site_letting;
INSERT INTO new_db.profiles_profile(id,favorite_city,user_id) SELECT id,favorite_city,user_id FROM oc_lettings_site_profile;
INSERT INTO new_db.lettings_address(id,number,street,city,state,zip_code,country_iso_code) SELECT id,number,street,city,state,zip_code,country_iso_code FROM oc_lettings_site_address;
INSERT INTO new_db.auth_user(id,password,last_login,is_superuser,username,first_name,email,is_staff,is_active,date_joined,last_name) SELECT id,password,last_login,is_superuser,username,first_name,email,is_staff,is_active,date_joined,last_name FROM auth_user
ON TRIGGER (
NOT behavior.[Close session]
AND session(parameter.[Page URL] LIKE '%uclahealth.org/FORMURL%')
AND NOT session(parameter.[Page URL] LIKE '%uclahealth.org/THANKYOUURL%')
)
SELECT
Latest(parameter.[Page URL]) FILTER (
WHERE
parameter.[Page URL] LIKE '%uclahealth.org/FORMURL%'
)
// create
// starts as pending
const arrived = true;
const ride = new Promise((resolve, reject) => {
// executor (callback function)
if (arrived) {
resolve('arrived');
} else {
reject('failed');
}

ALTER USER username WITH PASSWORD '123'

<embed src="/files/documents/document.pdf" width="100%" height="auto">
<style>
embed[src*="document.pdf"] {
width: 100%;
height: 100vh;
}
</style>