🤷♂️
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
<!-- | |
EMMET CODE | |
Copy the two lines below | |
--> | |
<!DOCTYPE html> | |
html>(head(meta[charset=UTF-8]+title+meta[author]+meta[generator]+meta[name=keywords][content]+meta[name=description][content]+link[href][type=text/css][rel=stylesheet]+script[src][type=text/javascript])+body(header+main(section#.(h1(lorem5)+p*3(lorem))+section#.(h2(lorem5)+div.(p*2(lorem))))+footer>p(ul.nav-footer>li*3>a(lorem2)))) | |
<!-- | |
RESULT |
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 | |
// Select and update user by role | |
$role = user_role_load_by_name('blogger'); | |
$query = 'SELECT ur.uid FROM {users_roles} AS ur WHERE ur.rid = :rid'; | |
$result = db_query($query, array(':rid' => $role->rid)); | |
$uids = $result->fetchCol(); | |
$users = user_load_multiple($uids); | |
foreach($users as $user) { | |
// $user->field_to_update['und'][0]['value'] = 1; | |
// user_save($user); |
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
// Export fields and their instances | |
// for Drupal module development | |
// @see http://steindom.com/articles/exporting-and-creating-field-definitions-drupal-7 | |
$entity_type = 'node'; | |
$field_name = 'field_gallery_user_lname'; | |
$bundle_name = 'gallery'; | |
$info_config = field_info_field($field_name); | |
$info_instance = field_info_instance($entity_type, $field_name, $bundle_name); |
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
$order_id = 8442; // change this to your order_id value | |
$order = commerce_order_load($order_id); | |
$shipping_profile_id = $order->commerce_customer_shipping[LANGUAGE_NONE][0]['profile_id']; | |
$address_shipping_profile = commerce_customer_profile_load($shipping_profile_id); | |
$as = $address_shipping_profile->commerce_customer_address['und'][0]; | |
$billing_profile_id = $order->commerce_customer_billing[LANGUAGE_NONE][0]['profile_id']; | |
$address_billing_profile = commerce_customer_profile_load($billing_profile_id); | |
$ab = $address_billing_profile->commerce_customer_address['und'][0]; |
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
$q = db_select('commerce_license', 'l'); | |
// $q->condition('l.type', your_type'); | |
// $q->condition('l.status', 2); // 2 = active | |
$q->fields('l', array('license_id') ); | |
$lids = $q->execute()->fetchCol(); | |
$ls = entity_load('commerce_license', $lids); | |
dpm($ls); | |
foreach($ls as $l){ | |
$info = $l->wrapper->getPropertyInfo(); |
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
// How to use? | |
makeClick($('.clickable')); //Make things clickable | |
/* | |
* Make an HTML element clickable | |
* Usefull for a fully clickable div without to wrap it in a <a> | |
* @param $el jQuery DOM object(s) | |
* return void | |
*/ | |
function makeClick($el) { |
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 show_activation_error() { | |
update_option( 'plugin_error', ob_get_contents() ); | |
$error = get_option( 'plugin_error' ); | |
wp_die($error); | |
} | |
add_action( 'activated_plugin', 'show_activation_error' ); |
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 | |
// Encode a file to base64 | |
function encode_file64($path, $print = false) { | |
$file = file_get_contents($path); | |
$e = base64_encode($file); | |
if( $print ) | |
print ($e); | |
return $e; | |
} |
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
/* | |
* Redirect to error page | |
* @param $site string Wether is for mobile or desktop site | |
* @param $err_code int Error code | |
* @param $path bool|string Force a path for redirection | |
* @see http://www.kobashicomputing.com/creating-custom-drupal-6-error-pages | |
* @return header() | |
*/ | |
function _goto_error_page($site = 'mobile', $err_code = 404, $path = false) { | |
$variable_name = ($site == 'mobile') ? "site_mobile_$err_code" : "site_$err_code"; |
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 req = new XMLHttpRequest(); | |
req.open('GET', document.location, false); | |
req.send(null); | |
req.getResponseHeader('Date'); |
OlderNewer