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 | |
namespace Project\WooCommerce\Gateways; | |
class Estimates extends \WC_Payment_Gateway { | |
const ID = 'estimates-gateway'; | |
const WC_STATUS = 'wc-estimate'; | |
public function __construct() { |
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 | |
unload_textdomain( 'woocommerce' ); | |
WC()->countries->states = null; | |
WC()->countries->load_country_states(); | |
$formatted_address = WC()->countries->get_formatted_address( $address ); | |
WC()->load_plugin_textdomain(); | |
WC()->countries->load_country_states(); | |
//$formatted_address was now in English! |
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_action( 'woocommerce_checkout_create_order', function( $order, $data ) { | |
// For my example I only want to do this on payments through cash on delivery gateway | |
// This is not a requirement though, you can do it for any reason you want. | |
if ( $order->get_payment_method() !== 'cod' ) { | |
return; | |
} | |
// I get my fee from the COD gateway settings field we added |
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_filter( 'woocommerce_settings_api_form_fields_cod', function( $form_fields ) { | |
$form_fields[ 'custom_fee' ] = [ | |
'title' => __( 'Fee in $', 'textdomain' ), | |
'type' => 'number', | |
'description' => __( 'Add a fee to orders using Cash on Delivery gateway.', 'textdomain' ), | |
'default' => 0, | |
'min' => 0, | |
'step' => .01, |
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 | |
/* | |
Plugin Name: My Custom Plugin |
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 | |
/** | |
* @param $value | |
* @param $option_value | |
*/ | |
function my_special_field( $value, $option_value ) { | |
?> | |
<tr> | |
<th scope="row" class="titledesc" colspan="2"> | |
<input type="text" name="my_special_field" value="<?php esc_attr( give_get_option( 'my_special_field' ); ?>" /> |
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 | |
/** | |
* @param $value | |
* @param $option_value | |
*/ | |
function my_custom_subtitle( $value, $option_value ) { | |
?> | |
<tr> | |
<th scope="row" class="titledesc" colspan="2"> |
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 enumsModule = require("ui/enums"); | |
var cameraModule = require("camera"); | |
var fs = require('file-system'); | |
var bghttp = require("nativescript-background-http"); | |
exports.takephoto = function(args) { | |
cameraModule.takePicture({width: 800, height: 800, keepAspectRatio: true}).then(function(picture) { | |
var savepath = fs.knownFolders.currentApp().path + "/saved_images"; | |
var filename = 'img_' + new Date().getTime() + '.jpg'; | |
var filepath = fs.path.join(savepath, filename); |
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
ropeObject.getHolder().addChildNode(ropeObject.getRope()) | |
links.forEach { link in | |
ropeObject.getHolder().addChildNode( link ) | |
} |
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
/** Generate our rope links **/ | |
var cnt:Float = 0.0 | |
var previousLink: SCNNode = ropeObject.getRope() | |
var links :[SCNNode] = [SCNNode]() | |
while cnt < 2.0 { | |
let link = ropeObject.getLink( y: Float(cnt) ) | |
links.append(link) | |
let joint = SCNPhysicsBallSocketJoint( | |
bodyA: link.physicsBody!, |