Skip to content

Instantly share code, notes, and snippets.

View xuxucode's full-sized avatar

xuxucode xuxucode

  • fulltech co. ltd.
View GitHub Profile
@xuxucode
xuxucode / restful_support_more_entities.patch
Last active August 29, 2015 14:17
Add support for commerce_product_reference, commerce_line_item and field_collection to RestfulEntityBase
diff --git a/plugins/restful/RestfulEntityBase.php b/plugins/restful/RestfulEntityBase.php
index 4155075..4c29f96 100644
--- a/plugins/restful/RestfulEntityBase.php
+++ b/plugins/restful/RestfulEntityBase.php
@@ -460,6 +460,15 @@ abstract class RestfulEntityBase extends \RestfulDataProviderEFQ implements \Res
elseif ($field['type'] == 'taxonomy_term_reference') {
return 'taxonomy_term';
}
+ elseif ($field['type'] == 'commerce_product_reference') {
+ return 'commerce_product';
@xuxucode
xuxucode / DragLinearLayout.java
Last active August 29, 2015 14:22
enable LayoutTransition immediately upon onDragStop()
package com.jmedeisis.draglinearlayout;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;

Hello AsciiDoctor

Hahah

AAA

BBB

CCC

111

222

333

aaa

bbb

ccc

@xuxucode
xuxucode / MyTodo.elm
Last active November 20, 2016 14:05
Todo elm learning
port module MyTodo exposing (..)
{-| TodoMVC implemented in Elm, using plain HTML and CSS for rendering.
This application is broken up into three key parts:
1. Model - a full definition of the application's state
2. Update - a way to step the application state forward
3. View - a way to visualize our application state with HTML
@xuxucode
xuxucode / myindex.html
Created November 18, 2016 10:18
todo elm
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Elm • TodoMVC</title>
<script type="text/javascript" src="myelm.js"></script>
<link rel="stylesheet" href="style.css">
</head>
@xuxucode
xuxucode / Login.elm
Created November 23, 2016 02:13
Login
module Login exposing (..)
import Html exposing (Html, div, p, input, button, text)
import Html.Attributes exposing (type_, name, value, placeholder)
import Html.Events exposing (onInput, onClick)
import Http
import Json.Decode as Json
import Json.Decode.Pipeline exposing (decode, required)
import Base64
@xuxucode
xuxucode / ignore_map_fields.patch
Last active January 25, 2018 01:42
Drupal GraphQL 3.x patch
diff --git a/modules/graphql_core/src/Plugin/Deriver/Fields/EntityFieldDeriver.php b/modules/graphql_core/src/Plugin/Deriver/Fields/EntityFieldDeriver.php
index def5716..ea5e931 100644
--- a/modules/graphql_core/src/Plugin/Deriver/Fields/EntityFieldDeriver.php
+++ b/modules/graphql_core/src/Plugin/Deriver/Fields/EntityFieldDeriver.php
@@ -29,6 +29,10 @@ class EntityFieldDeriver extends EntityFieldDeriverWithTypeMapping {
return [];
}
+ if ($fieldDefinition->getType() === 'map') {
+ return [];
@xuxucode
xuxucode / entity_id_integer_and_index.patch
Last active January 18, 2018 08:40
Drupal entity_id integer and flag_id__uid index
diff --git a/flag.install b/flag.install
index ec4794b..42ba3ba 100644
--- a/flag.install
+++ b/flag.install
@@ -30,9 +30,10 @@ function flag_schema() {
],
'entity_id' => [
'description' => 'The unique ID of the flagged entity, for example the uid, cid, or nid.',
- 'type' => 'varchar_ascii',
- 'length' => ConfigEntityStorage::MAX_ID_LENGTH,
@xuxucode
xuxucode / graphql_query_sort.patch
Last active February 8, 2018 03:32
Sort Drupal GraphQL entity query result
diff --git a/modules/graphql_core/src/Plugin/GraphQL/Fields/EntityQuery/EntityQuery.php b/modules/graphql_core/src/Plugin/GraphQL/Fields/EntityQuery/EntityQuery.php
index 1479897..5e35b82 100644
--- a/modules/graphql_core/src/Plugin/GraphQL/Fields/EntityQuery/EntityQuery.php
+++ b/modules/graphql_core/src/Plugin/GraphQL/Fields/EntityQuery/EntityQuery.php
@@ -27,7 +27,8 @@ use Youshido\GraphQL\Execution\ResolveInfo;
* "limit" = {
* "type" = "Int",
* "default" = 10
- * }
+ * },
@xuxucode
xuxucode / purchased_entity_type.patch
Created December 13, 2017 06:21
Commerce order item purchased entity type
diff --git a/modules/order/commerce_order.info.yml b/modules/order/commerce_order.info.yml
index d7edcd74a..1c31916ba 100644
--- a/modules/order/commerce_order.info.yml
+++ b/modules/order/commerce_order.info.yml
@@ -11,6 +11,7 @@ dependencies:
- options
- profile
- state_machine
+ - commerce:commerce_product
config_devel: