Skip to content

Instantly share code, notes, and snippets.

zdenko / dc_emw.php
Created Nov 22, 2016 — forked from BBGuy/dc_emw.php
Working with Drupal commerce entities using entity_metadata_wrapper. Just a bunch of exampled copied from the web or added by me. will keep adding over time.
View dc_emw.php
// order.
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
// Order id.
$order_id = order_wrapper->order_id->value();
// User detils.
zdenko / random_password.rb
Last active May 14, 2016
Random password
View random_password.rb
def make_password(len) { [*'0'..'9', *'a'..'z', *'A'..'Z'].sample }.join
zdenko / flatten.php
Last active Jan 24, 2016
Function to recursively flatten multidimensional PHP array.
View flatten.php
function flatten_array($arg) {
return is_array($arg) ? array_reduce($arg, function ($c, $a) { return array_merge($c, flatten_array($a)); },[]) : [$arg];
You can’t perform that action at this time.