Skip to content

Instantly share code, notes, and snippets.

View luco's full-sized avatar
🏠
Working from home

Lucas Veiga luco

🏠
Working from home
View GitHub Profile
<?php
/*
This script will allow you to send a custom email from anywhere within wordpress
but using the woocommerce template so that your emails look the same.
Created by craig@123marbella.com on 27th of July 2017
Put the script below into a function or anywhere you want to send a custom email
*/
// transform cropper dataURI output to a Blob which Dropzone accepts
function dataURItoBlob(dataURI) {
var byteString = atob(dataURI.split(',')[1]);
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ab], { type: 'image/jpeg' });
}
@luco
luco / RCTTextFieldManager.m
Created December 1, 2017 13:38 — forked from renso3x/RCTTextFieldManager.m
add this function showNextButton
RCT_CUSTOM_VIEW_PROPERTY(showNextButton, BOOL, RCTTextField)
{
if (json && ([RCTConvert BOOL:json])) {
UIToolbar* toolbar = [[UIToolbar alloc] init];
[toolbar sizeToFit];
UIBarButtonItem* flex = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil action:nil];
UIBarButtonItem* doneButton = [[UIBarButtonItem alloc]
@luco
luco / showDoneButton.patch
Created August 19, 2017 01:45 — forked from chih/showDoneButton.patch
Adding showDoneButton property to react native's TextInput for number fields
diff --git a/node_modules/react-native/Libraries/Text/RCTTextField.h b/node_modules/react-native/Libraries/Text/RCTTextField.h
index c809f10..2d80af4 100644
--- a/node_modules/react-native/Libraries/Text/RCTTextField.h
+++ b/node_modules/react-native/Libraries/Text/RCTTextField.h
@@ -31,5 +31,6 @@
- (void)textFieldDidChange;
- (void)sendKeyValueForString:(NSString *)string;
- (BOOL)textFieldShouldEndEditing:(RCTTextField *)textField;
+- (void)handleDoneButtonFromInputAccessory;
@luco
luco / functions.php
Created May 8, 2017 19:51 — forked from eljamez/functions.php
Woocommerce, get the product's attribute title from attribute slug
// just pass in the attribute and the attribute slug
// and the return value is the attribute's name
// example : (assuming attribute size has the option of "Extra Small" withe the slug of "extra-small")
// echo attribute_slug_to_title('attribute_pa_size', 'extra-small');
// returns
// "Extra Small"
// code reworked from woocommerce/classes/class-wc-cart.php