Skip to content

Instantly share code, notes, and snippets.

View dyslabpro's full-sized avatar

Yurii Diubets dyslabpro

View GitHub Profile
<?php
function _commerce_tax_included_commerce_order_presave($order) {
//checkout_shipping
$custom_vat = 0;
$profile_id = $order->commerce_customer_shipping['und'][0]['profile_id'];
$profile = commerce_customer_profile_load($profile_id);
if ($profile->commerce_customer_address['und'][0]['postal_code'] == 'GY Guernsey') {
//change vat
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
<?php
/**
* Implements hook_field_formatter_info().
*/
function custom_content_management_field_formatter_info() {
return array(
'custom_boolean' => array(
'label' => t('Custom boolean'),
'field types' => array('list_boolean'),
<?php
function custom_contact_lenses_field_extra_fields() {
$extra['node'][CUSTOM_CONTACT_LENSES_NODE_TYPE]['display']['cl_also_sold_as_price'] = array(
'label' => t('Also sold@price'),
'description' => t(''),
'configurable' => TRUE,
'weight' => -10,
);
return $extra;
<?php
function store_custom_views_query_alter(&$view, &$query) {
if ($view->name == 'full_store_list') {
foreach ($query->orderby as &$orderby_group) {
if ($orderby_group['field'] == 'store_name') {
$orderby_group['direction'] = 'collate utf8_swedish_ci';
@dyslabpro
dyslabpro / gist:6070965
Created July 24, 2013 14:15
iOS 6.0.2, iPhone 5 Safari User Agent String
Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_2 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A551 Safari/8536.25
<?php
/**
* Implements hook_boot().
*/
function rules_mobile_redirection_boot() {
if (($_SERVER['REQUEST_URI'] != '/') || ($_SERVER['QUERY_STRING'] == 'fromMobile')) {
$params = session_get_cookie_params();
setcookie(RULES_MOBILE_REDIRECTION_SESSION_KEY, 1, time() + 7200, '/');
}
Afrikaans = Latin1_General_CI_AS
Albanian = Albanian_CI_AS
Arabic (Algeria) = Arabic_CI_AS
Arabic (Bahrain) = Arabic_CI_AS
Arabic (Egypt) = Arabic_CI_AS
Arabic (Iraq) = Arabic_CI_AS
Arabic (Jordan) = Arabic_CI_AS
Arabic (Kuwait) = Arabic_CI_AS
Arabic (Lebanon) = Arabic_CI_AS
Arabic (Libya) = Arabic_CI_AS

Developer libs

mysql, rmagic, curl, git, vim, sqlite, nodejs nokogiri...

sudo apt-get install libxslt1-dev libxml2-dev libmagickwand-dev imagemagick libsqlite3-dev libcurl4-openssl-dev curl git git-gui vim-gtk mysql-server mysql-client ruby-mysql libmysqlclient-dev mysql-workbench exuberant-ctags icedtea-plugin nodejs rar wmctrl

Ruby

ruby 1.9.3