Skip to content

Instantly share code, notes, and snippets.

@Yang03
Yang03 / children
Last active June 6, 2018 09:35
react
function RadioOption(props) {
return (
<label>
<input type="radio" value={props.value} name={props.name} />
{props.label}
</label>
)
}
function renderChildren(props) {
var subItems = Array.from(document.querySelectorAll('.sub-item'))
subItems.forEach((item) => {
item.onclick = function() {
var classList = this.classList
if (classList.contains('animation-open')) {
classList.remove('animation-open')
} else {
classList.add('animation-open')
}
```
const test = Vue.component('test', {
props: ['msg'],
template:'<div><p>{{msg}}</p><slot name="action">xx</slot></div>'
})
new Vue({
el: '#app',
function daysInMonth (year, month) {
return /8|3|5|10/.test(month) ? 30 : month === 1 ? (!(year % 4) && year % 100) || !(year % 400) ? 29 : 28 : 31
}
function formatDate (date, format, translation) {
translation = (!translation) ? en : translation
let year = date.getFullYear()
let month = date.getMonth() + 1
let day = date.getDate()
let str = format
{
"messageActionDetails": {
"messageFunctionDetails": {
"messageFunction": "183",
"additionalMessageFunction": "M1"
}
},
"itineraryDetails": {
"originDestinationDetails": {
"origin": "YVR",
.content-box {
width:200px;
height: 200px;
box-sizing: content-box;
padding: 10px;
border: 10px solid #f46;
margin: 10px;
}
[{"numberOfPax":{"segmentControlDetails":{"quantity":"1","numberOfUnits":"1"}},"passengersID":[{"travellerDetails":{"measurementValue":"1"}}],"fareInfoGroup":{"emptySegment":null,"pricingIndicators":{"priceTariffType":"I","productDateTimeDetails":{"departureDate":"180818"},"companyDetails":{"otherCompany":"EY"}},"fareAmount":{"monetaryDetails":{"typeQualifier":"B","amount":"3140","currency":"AED"},"otherMonetaryDetails":[{"typeQualifier":"E","amount":"1123.00","currency":"CAD"},{"typeQualifier":"712","amount":"1537.03","currency":"CAD"}]},"textData":[{"freeTextQualification":{"textSubjectQualifier":"4","informationType":"15"},"freeText":"18AUG18AUH EY NYC Q2.50Q40.84 811.38NUC854.72END ROE3.672750"},{"freeTextQualification":{"textSubjectQualifier":"1","informationType":"1P3"},"freeText":"PENALTY APPLIES"},{"freeTextQualification":{"textSubjectQualifier":"1","informationType":"10"},"freeText":"NON ENDO/ REF -BG:EY"},{"freeTextQualification":{"textSubjectQualifier":"1","informationType":"1A49"},"freeText":"- DA
@Yang03
Yang03 / gist:f2ebee7ef5d21a2e88904134a07edf30
Last active August 3, 2018 09:46
canvas draw multi line text and circle avatar
public async drawActivityPoster() {
const {windowWidth} = wx.getSystemInfoSync()
const width = windowWidth * 80 / 100
const ctx = wx.createCanvasContext('poster')
this.drawText({
text: '我的店铺',
ctx :ctx,
x: 0,
y: 100,
fontSize: 14,
void function(){
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
import { createSoapClient, createSoapHeader } from '../lib/amadeus'
import { writeJson, requestXml, requestJson } from '../util/apiJson'
import OrderService from '../service/order'
import { getPayAmount } from '../service/flights/getPayAmount'
import Str from '../db/redis/str'
exports.PNRAddMultiElements = async function (req, res) {
const data = req.body
const searchInput = buildQuery(data)
const validate = validateAge(data)