Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
{"results":[{"fsq_id":"4c42bf92d691c9b601db8e0a","categories":[{"id":13034,"name":"Café","icon":{"prefix":"https://ss3.4sqi.net/img/categories_v2/food/cafe_","suffix":".png"}}],"chains":[],"distance":202,"geocodes":{"main":{"latitude":52.237009,"longitude":-0.896756}},"link":"/v3/places/4c42bf92d691c9b601db8e0a","location":{"address":"George Row","admin_region":"England","country":"GB","formatted_address":"George Row, Northampton, NN1 1DF","locality":"Northampton","post_town":"Northampton","postcode":"NN1 1DF"},"name":"All Saints Bistro - Northampton","related_places":{"parent":{"fsq_id":"5091102de4b09fc320fc18bb","name":"All Saints Church"}},"timezone":"Europe/London"},{"fsq_id":"57ff893738fa6cf9d0864e65","categories":[{"id":13016,"name":"Lounge","icon":{"prefix":"https://ss3.4sqi.net/img/categories_v2/nightlife/default_","suffix":".png"}},{"id":13034,"name":"Café","icon":{"prefix":"https://ss3.4sqi.net/img/categories_v2/food/cafe_","suffix":".png"}},{"id":13065,"name":"Restaurant","icon":{"prefix":"https:// |
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
# Split all arguments for easier use in commands. | |
# You can now use the variables: ${ARGS} ${ARG_1} ${ARG_2} ${ARG_3} ${ARG_REST} | |
# @see https://stackoverflow.com/questions/2214575/passing-arguments-to-make-run#answer-45003119 | |
ARGS = $(filter-out $@,$(MAKECMDGOALS)) | |
ARG_1 = $(word 1, ${ARGS}) | |
ARG_2 = $(word 2, ${ARGS}) | |
ARG_3 = $(word 3, ${ARGS}) | |
ARG_REST = $(wordlist 2, 100, ${ARGS}) | |
## We use the following rule/recipe to prevent errors messages when passing arguments in make commands | |
## @see https://stackoverflow.com/a/6273809/1826109 |
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 | |
$display = \Drupal::entityTypeManager() | |
->getStorage('entity_view_display') | |
->load($param->getEntityTypeId() . '.' . $param->bundle() . '.default'); | |
if ($display && $display->isLayoutBuilderEnabled()) { | |
foreach($display->getSections() as $section) { | |
$result = (bool) array_filter( | |
$section->getComponents(), | |
function (SectionComponent $component) use ($plugin_id) { |
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
import axios from "axios"; | |
import { saveAs } from "file-saver"; | |
axios(`${apiUrlPrefix}/file/5`, { | |
method: 'GET', | |
responseType: 'blob', | |
headers: { | |
'Authorization': `Bearer ${token}`, | |
} | |
}).then(response => { |
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
/** | |
* Cache class for search. | |
* | |
* Avoid unnecessary api request by caching the results. | |
*/ | |
class CacheSearch { | |
constructor() { | |
this.query = ''; | |
this.queryCount = 0; | |
this.cache = {}; |
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
class FrogBuilder { | |
constructor(name, gender) { | |
// Ensure that the first character is always capitalized | |
this.name = name.charAt(0).toUpperCase() + name.slice(1) | |
this.gender = gender | |
} | |
formatEyesCorrectly(eyes) { | |
return Array.isArray(eyes) ? { left: eye[0], right: eye[1] } : eyes | |
} | |
setEyes(eyes) { |
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
console.log(performance.memory.usedJSHeapSize) |
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
// Helper method to handle error and expact only error or result. | |
export const createFetcher = promiseFunc => { | |
return { | |
read: arg => { | |
try { | |
return promiseFunc(arg) | |
.then(response => { | |
if (!response) { | |
return {error: '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 | |
namespace Drupal\custom_decorator_override; | |
use Drupal\custom_decorator_base\OriginalService; | |
use Symfony\Component\HttpFoundation\RequestStack; | |
/** | |
* Class OriginalServiceOverride | |
*/ | |
class OriginalServiceOverride extends OriginalService { | |
/** | |
* Original service object. |
NewerOlder