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 React, { useEffect, useRef, useState } from 'react'; | |
import { | |
StyleSheet, | |
Text, | |
View, | |
Animated, | |
TouchableOpacity, | |
Pressable, | |
} from 'react-native'; | |
import { useReduceMotion } from './src/hooks/useReduceMotion'; |
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 { useEffect, useState } from 'react' | |
import { AccessibilityInfo } from 'react-native' | |
// Adapted from https://github.com/infiniteluke/react-reduce-motion/blob/master/src/targets/native/index.js | |
export const useReduceMotion = (): boolean => { | |
const [shouldReduceMotion, setShouldReduceMotion] = useState(false) | |
useEffect(() => { | |
const handleChange = (isReduceMotionEnabled: boolean): void => { | |
setShouldReduceMotion(isReduceMotionEnabled) |
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 | |
function convertName($full_name) { | |
$split_name = explode(' ', $full_name); | |
if (count($full_name) !== 2) { | |
// Single word name. | |
return $full_name; | |
} | |
// Must use mb_substr otherewise utf8 issues can occur with foreign names. | |
return mb_substr($split_name[0], 0, 1) . ' ' . mb_substr($split_name[1], 0, 1) . '.'; |
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
const MyComponent = (rootElement) => { | |
const subEl = rootElement.querySelector('.js-some-btn'); | |
console.log(rootElement, "i'm working!"); | |
}; | |
export default MyComponent; |
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
/* | |
Example safe-executing JS script for Lewagon. | |
packs/plugins/myPlugin.js | |
*/ | |
export const initMyPlugin = (selector) => { | |
const elements = Array.from(document.querySelectorAll(selector)); | |
return elements.map(el => new MyPlugin(el)); | |
}; |
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
{ | |
"name": "my-app", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"react": "^16.8.6", | |
"react-dom": "^16.8.6", | |
"react-scripts": "3.0.1" | |
}, | |
"devDependencies": { |
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
leafletElement.eachLayer(function(layer) { | |
// Re-render tooltips that have automatic positioning on map pan events. | |
if(layer.options.direction && layer.options.direction === 'auto') { | |
layer.update(); | |
} | |
}); |
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 | |
/** | |
* @file | |
* A description of the code contained in this file. | |
*/ | |
/** | |
* Implements hook_init(). | |
*/ | |
function my_custom_module_init() { |
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
name = My custom module | |
description = Runs some hooks and PHP code. | |
package = All of my modules | |
core = 7.x | |
; Our module depends on node. | |
dependencies[] = node | |
; Our module could include views handlers. | |
; files[] = my_custom_module.views.inc |
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
(function ($) { | |
Drupal.behaviors.my_custom_module = { | |
attach: function(context, settings) { | |
// Use context to ensure the link is only ever activated if it's regenerated. | |
var $mySpecialLink = $('#my-special-link', context); | |
// Only run if the link exists in the current page load or fragment refresh. | |
if ($mySpecialLink.size() > 0) { | |
new Drupal.ajax('#my-special-link', $mySpecialLink, { | |
url: $mySpecialLink.attr('href'), |
NewerOlder