- Windows 10
- Ubuntu 22.04 WSL
- zsh
- git
| <?php | |
| function create_ACF_meta_in_REST() { | |
| $postypes_to_exclude = ['acf-field-group','acf-field']; | |
| $extra_postypes_to_include = ["page"]; | |
| $post_types = array_diff(get_post_types(["_builtin" => false], 'names'),$postypes_to_exclude); | |
| array_push($post_types, $extra_postypes_to_include); | |
| foreach ($post_types as $post_type) { | |
| register_rest_field( $post_type, 'ACF', [ |
| # thai_strftime() | |
| # Thai date and time string formatter | |
| # Formatting directives similar to datetime.strftime() | |
| # | |
| # จัดรูปแบบข้อความวันที่และเวลา แบบเดียวกับ datetime.strftime() | |
| # โดยจะใช้ชื่อเดือนเป็นภาษาไทย และปีเป็นพุทธศักราช | |
| # (ไม่รองรับปีก่อน พ.ศ. 2484 - ก่อนการเปลี่ยนวันปีใหม่ไทย) | |
| # | |
| # No Rights Reserved | |
| # PUBLIC DOMAIN or CC0 1.0 Universal |
| <?php | |
| namespace App\Filter; | |
| use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractContextAwareFilter; | |
| use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface; | |
| use Doctrine\ORM\QueryBuilder; | |
| final class OrSearchFilter extends AbstractContextAwareFilter | |
| { |
| const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
| const asyncForEach = async (array, callback) => { | |
| for (let index = 0; index < array.length; index++) { | |
| await callback(array[index], index, array) | |
| } | |
| } | |
| const start = async () => { | |
| await asyncForEach([1, 2, 3], async (num) => { | |
| await waitFor(50) |
| type FilterOperator = 'AND' | 'OR'; | |
| type FiltersBy<T> = { | |
| [K in keyof T]?: (value: T[K]) => boolean; | |
| }; | |
| /** | |
| * Factory function that creates a specialized function to filter | |
| * arrays, by validating all filters (AND operator), | |
| * or validating just one of the filters (OR operator). | |
| * @param operator Method to validate all filters: AND, OR |
This script for Google Spreadsheets allows you to generate slugs for your data such as might be used for creating unique urls.
Use it like this!
| # | A | B | C |
|---|---|---|---|
| 1 | a | b | slug |
| 2 | foo | baz bing | =slugify(A2:B4) |
| 3 | bar | BAZ | |
| 4 | FOO | baz-bing |