Skip to content

Instantly share code, notes, and snippets.

View whs's full-sized avatar

Manatsawin Hanmongkolchai whs

View GitHub Profile
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)
import template from 'babel-template'
const I18n$tCall = template('I18n.$t({th: TH, en: EN})')
export default function({types: t}){
return {
visitor: {
CallExpression(path) {
// ...
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'
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,
})
terraform {
}
provider "cloudflare" {
email = ""
api_key = ""
}
provider "huaweicloud" {
auth_url = "https://iam.myhwclouds.com:443/v3"
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
<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{
import {caches as defaultCaches} from 'emotion';
import parse5 from 'parse5';
import {
insertBefore,
createElement,
insertText,
createDocumentFragment,
appendChild,
} from 'parse5/lib/tree-adapters/default';
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'
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;