Skip to content

Instantly share code, notes, and snippets.

View mohammadYousefiDev's full-sized avatar
🙂
every thing is great

Mohammad Yousefi mohammadYousefiDev

🙂
every thing is great
View GitHub Profile
@mohammadYousefiDev
mohammadYousefiDev / gist:015e219f1c5c2fb97c5f0bc1060eed3f
Last active June 27, 2022 12:03
Terawallet credit or debit ballance transactions programmatically
woo_wallet()->wallet->credit($user_id, $amount, $description);
woo_wallet()->wallet->debit($user_id, $amount, $description);
@mohammadYousefiDev
mohammadYousefiDev / gist:5fc224fba642f6a813eb26ec2782057c
Last active December 22, 2020 07:07
show/hide navbar dropdown menu on hover in bootstrap-vue
<b-nav-item-dropdown v-b-hover="onOverService" ref="showServices" text="services">
<b-dropdown-item to="/">one</b-dropdown-item>
<b-dropdown-item to="/">two</b-dropdown-item>
</b-nav-item-dropdown>
<!-- method -->
onOverService(isHovered)
{
if(isHovered)
this.$refs.showService.visible = true
@mohammadYousefiDev
mohammadYousefiDev / index.html
Last active August 2, 2020 19:23
Group by in laravel withcount orm
<?php
//in Model.php
public function contributes()
{
return $this->hasmany('\App\ExamUserSelect', 'exam_id');
}
/* in controller
* grouped by group_id
@mohammadYousefiDev
mohammadYousefiDev / gist:2cb56b5e7b0c453ac26eae849cfcfa02
Created July 26, 2020 05:46
show file name when file input changed in mdb
<div class="form-file">
<input type="file" class="form-file-input" onchange="changeFile(this.files[0].name, 'form-file-personal-text')" id="customFile" name="personal" required/>
<label class="form-file-label" for="customFile">
<span class="form-file-text" id="form-file-personal-text">Personal Image ...</span>
<span class="form-file-button">Select</span>
</label>
</div>
<script>
function changeFile(filename, id)
@mohammadYousefiDev
mohammadYousefiDev / index.html
Last active January 15, 2020 15:16
1. access to element in javascript
<html>
<head></head>
<body>
<p name="codepenName" id="codepenID" class="codepenClass">Hello World</p>
<script>
//way1
/*
var x = window.document.getElementById('codepenID')
<?php
/**
* Add custom meta to order
*/
function plugin_republic_checkout_create_order_line_item( $item, $cart_item_key, $values, $order ) {
if( isset( $values['pr_field'] ) ) {
$item->add_meta_data(
__( 'Your name', 'plugin-republic' ),
$values['pr_field'],
true
@AliMD
AliMD / regular-expression-iranian-mobile.md
Last active March 15, 2024 15:03
Best Regular Expression for Detect Iranian Mobile Phone Numbers

Best Regular Expression for Detect Iranian Mobile Phone Numbers

I'm sure its best regular expression for detect iranian mobile number.

(0|\+98)?([ ]|,|-|[()]){0,2}9[1|2|3|4]([ ]|,|-|[()]){0,2}(?:[0-9]([ ]|,|-|[()]){0,2}){8}


use in javascript

@carlosleopoldo
carlosleopoldo / delete-orphans-usermeta.sql
Last active June 16, 2023 13:23
Delete all orphans user meta in WordPress
DELETE FROM wp_usermeta
WHERE NOT EXISTS (
SELECT * FROM wp_users
WHERE wp_usermeta.user_id = wp_users.ID
)