This file contains 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 | |
add_shortcode( 'user_company_link', 'yanco_user_company_link' ); | |
function yanco_user_company_link() { | |
if( ! is_user_logged_in() ) { | |
return; | |
} | |
$html = ''; |
This file contains 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
function Child({ onClick }) { | |
return <button onClick={onClick} type="button">Child Button</button>; | |
} | |
export default function Parent() { | |
const onClick = () => { | |
console.log('I\'m in the parent, but the child was clicked'); | |
}; | |
return ( |
This file contains 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
<!--[if mso]> | |
<center> | |
<table><tr><td width="580"> | |
<![endif]--> | |
<div style="max-width:580px; margin:0 auto;"> | |
<p>This text will be centered and constrained to 580 pixels even on Outlook which does not support max-width CSS</p> | |
</div> | |
<!--[if mso]> |
This file contains 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 | |
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40 | |
class DumpHTTPRequestToFile { | |
public function execute($targetFile) { | |
$data = sprintf( | |
"%s %s %s\n\nHTTP headers:\n", | |
$_SERVER['REQUEST_METHOD'], |
This file contains 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 | |
/** Inserts a new node after a given reference node. Basically it is the complement to the DOM specification's | |
* insertBefore() function. | |
* @param \DOMNode $newNode The node to be inserted. | |
* @param \DOMNode $referenceNode The reference node after which the new node should be inserted. | |
* @return \DOMNode The node that was inserted. | |
*/ | |
function insertAfter(\DOMNode $newNode, \DOMNode $referenceNode) | |
{ | |
if($referenceNode->nextSibling === null) { |
This file contains 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 | |
global $wpdb; | |
// Start Transaction | |
$wpdb->query( "START TRANSACTION" ); | |
// Do some expensive/related queries here | |
//$wpdb->query("DELETE FROM table WHERE form_id = '1' "); | |
//$wpdb->query("DELETE FROM data WHERE form_id = '1' "); | |
// set $error variable value in error handling after $wpdb modifications |
This file contains 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
function index_progress_bar(title) { | |
var w = new Window("palette", title, undefined); | |
w.orientation = "column"; | |
var text_group = w.add("group"); | |
text_group.orientation = "column"; | |
var file_name = text_group.add("statictext", [0,0,350,20], "calculating.."); | |
var remain = text_group.add("statictext", [0,0,350,20], "Remain: .."); | |
text_group.alignChildren = "left"; | |
var progressbar = w.add("progressbar", undefined, 0, 100); | |
progressbar.preferredSize = [350,20]; |
This file contains 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
var doc = app.activeDocument; | |
if(doc.saved == true) | |
{ | |
extract(2); | |
} | |
else | |
{ | |
alert("Save you file."); | |
} |
This file contains 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 | |
// Place the following code in your theme's functions.php file | |
// override the quantity input with a dropdown | |
function woocommerce_quantity_input() { | |
global $product; | |
$defaults = array( | |
'input_name' => 'quantity', | |
'input_value' => '1', | |
'max_value' => apply_filters( 'woocommerce_quantity_input_max', '', $product ), |
This file contains 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
#!/usr/bin/env python3 | |
from subprocess import run, PIPE | |
completed_process = run(["docker-machine.exe", "env", "--shell", "bash"], stdout=PIPE) | |
docker_env = completed_process.stdout.decode("ascii") | |
for line in docker_env.split("\n"): | |
if "DOCKER_CERT_PATH" in line: |
NewerOlder