This file contains hidden or 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 importSpecifier = path.scope.generateUidIdentifier('th') | |
| const importDeclaration = this.t.importDeclaration( | |
| [this.t.importDefaultSpecifier(importSpecifier)], | |
| this.t.stringLiteral('lang/th/file.yaml?' + this.resourceQuery), | |
| ) | |
| program.unshiftContainer('body', importDeclaration) |
This file contains hidden or 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 template from 'babel-template' | |
| const I18n$tCall = template('I18n.$t({th: TH, en: EN})') | |
| export default function({types: t}){ | |
| return { | |
| visitor: { | |
| CallExpression(path) { | |
| // ... |
This file contains hidden or 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
| export default function({types: t}){ | |
| return { | |
| visitor: { | |
| CallExpression(path) { | |
| const node = path.node | |
| // เช็คว่าเป็น I18n.t จริง | |
| if ( | |
| !node.callee.object || | |
| node.callee.object.name !== 'I18n' || | |
| node.callee.property.name !== 't' |
This file contains hidden or 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 fs = require('fs') | |
| const yaml = require('js-yaml') | |
| module.exports = function(content) { | |
| // Load ไฟล์ภาษา | |
| const content = content || fs.readFileSync(this.resourcePath) | |
| let lang = yaml.safeLoad(content, { | |
| schema: yaml.FAILSAFE_SCHEMA, | |
| }) |
This file contains hidden or 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
| terraform { | |
| } | |
| provider "cloudflare" { | |
| email = "" | |
| api_key = "" | |
| } | |
| provider "huaweicloud" { | |
| auth_url = "https://iam.myhwclouds.com:443/v3" |
This file contains hidden or 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 json | |
| postcodes = json.load(open('../../../data/postcode-to-zones.json')) | |
| zones = json.load(open('_zones.json')) | |
| provinces = json.load(open('_provinces.json')) | |
| def find_province(id_): | |
| for province in provinces: | |
| if province['id'] == id_: | |
| return province |
This file contains hidden or 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
| <meta charset="UTF-8"> | |
| <meta property="og:type" content="website" /> | |
| <meta property="og:title" content="{% if amount %}Pay {{amount}}{% else %}Pay me{% endif %}" /> | |
| <meta property="og:image" content="{{qrUrl}}"> | |
| <meta property="og:url" content="{{url}}"> | |
| <meta property="og:description" content=""> | |
| <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0"> | |
| <title>{% if amount %}Pay {{amount}}{% else %}Pay me{% endif %}</title> | |
| <style> | |
| body{ |
This file contains hidden or 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 {caches as defaultCaches} from 'emotion'; | |
| import parse5 from 'parse5'; | |
| import { | |
| insertBefore, | |
| createElement, | |
| insertText, | |
| createDocumentFragment, | |
| appendChild, | |
| } from 'parse5/lib/tree-adapters/default'; |
This file contains hidden or 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 json | |
| from pathlib import Path | |
| from django import template | |
| from django.conf import settings | |
| register = template.Library() | |
| STATS_FILE = Path(__file__).parents[2] / 'static' / 'stats.json' |
This file contains hidden or 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
| proxy_cache_path /cache levels=1:2 keys_zone=one:100m; | |
| server { | |
| listen 80 default_server; | |
| server_name _; | |
| proxy_cache one; | |
| proxy_cache_valid 200 302 10m; | |
| proxy_cache_valid any 1m; | |
| proxy_ignore_headers Expires Cache-Control Set-Cookie Vary; | |
| add_header X-WN-Cache $upstream_cache_status; |