This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const checkConnection = () => { | |
// Check if browser is running Metamask | |
if (window.ethereum) { | |
web3 = new Web3(window.ethereum); | |
} else if (window.web3) { | |
web3 = new Web3(window.web3.currentProvider); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Code goes in theme functions.php or a custom plugin | |
add_filter( 'pre_option_woocommerce_enable_guest_checkout', 'conditional_guest_checkout_based_on_product' ); | |
function conditional_guest_checkout_based_on_product( $value ) { | |
$restrict_ids = array( 1, 2, 3 ); // Replace with product ids which cannot use guest checkout | |
if ( WC()->cart ) { | |
$cart = WC()->cart->get_cart(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import math | |
import os | |
import random | |
import re | |
import sys | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import math | |
import os | |
import random | |
import re | |
import sys | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-type: application/csv"); | |
$timestamp = date('d-m-Y'); //$timestamp takes the current time | |
$myFile = "order_export_".$timestamp.".csv"; // add timestamp to the file name | |
header("Content-Disposition: attachment; filename=".$myFile); | |
$fp = fopen('php://output', 'w'); | |
use Magento\Framework\App\Bootstrap; | |
require __DIR__ . '/app/bootstrap.php'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$countries = array( | |
"Afghanistan" => "Asia", | |
"Åland Islands" => "Europe", | |
"Albania" => "Europe", | |
"Algeria" => "Africa", | |
"American Samoa" => "Oceania", | |
"Andorra" => "Europe", | |
"Angola" => "Africa", | |
"Anguilla" => "North America", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Session::flash('message', 'This is a message!'); | |
Session::flash('alert-class', 'alert-danger'); | |
In view: | |
@if(Session::has('message')) | |
<p class="alert {{ Session::get('alert-class', 'alert-info') }}">{{ Session::get('message') }}</p> | |
@endif | |
OR: | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select id="month" name="month"> | |
<option value="0">Month</option> | |
<option value="1">January</option> | |
<option value="2">February</option> | |
<option value="3">March</option> | |
<option value="4">April</option> | |
<option value="5">May</option> | |
<option value="6">June</option> | |
<option value="7">July</option> | |
<option value="8">August</option> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT first_name from users where created_at > | |
( | |
select TIMESTAMPDIFF(YEAR, created_at, CURDATE()) | |
AS age from users where id=1 | |
) |
NewerOlder