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 / 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 / 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 / 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 / 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:
@xuxucode
xuxucode / search_api_solr_schema_string.patch
Created December 28, 2017 08:16
Change type boolean to string
diff --git a/config/install/search_api_solr.solr_field_type.m_text_und_5_2_0.yml b/config/install/search_api_solr.solr_field_type.m_text_und_5_2_0.yml
index f37be9e..0f4cb5a 100644
--- a/config/install/search_api_solr.solr_field_type.m_text_und_5_2_0.yml
+++ b/config/install/search_api_solr.solr_field_type.m_text_und_5_2_0.yml
@@ -26,7 +26,7 @@ field_type:
-
class: solr.ManagedStopFilterFactory
managed: stopwords
- # ignoreCase: true
+ # ignoreCase: 'true'
@xuxucode
xuxucode / graphql_cache_no_errors.patch
Created January 3, 2018 03:44
Prevent caching if there is an error occurs
diff --git a/src/GraphQL/Execution/QueryProcessor.php b/src/GraphQL/Execution/QueryProcessor.php
index 941b664..a2a7f27 100644
--- a/src/GraphQL/Execution/QueryProcessor.php
+++ b/src/GraphQL/Execution/QueryProcessor.php
@@ -100,9 +100,9 @@ class QueryProcessor {
$metadata->addCacheableDependency($container->get('metadata'));
}
- // Prevent caching if this is a mutation query.
+ // Prevent caching if this is a mutation query or an error occurs.
@xuxucode
xuxucode / order_paid_in_full_from_2.3.patch
Last active January 13, 2018 10:19
Order paid in full from tag 2.3
diff --git a/modules/order/commerce_order.post_update.php b/modules/order/commerce_order.post_update.php
index 26dd36c..7c47d89 100644
--- a/modules/order/commerce_order.post_update.php
+++ b/modules/order/commerce_order.post_update.php
@@ -7,6 +7,8 @@
use Drupal\Core\Entity\Entity\EntityFormDisplay;
+use Drupal\Core\Field\BaseFieldDefinition;
+