Skip to content

Instantly share code, notes, and snippets.

import re
normal_regex = '[$|£]\s*\S+\s*(?:million)?'
def tmp(b):
# ['$910,0001955 ', '$350,000 ']
normal = re.findall(normal_regex, b)
return normal
def cal_average_budget(budget_list):
@thisiswei
thisiswei / storesnearby.js
Last active May 21, 2021 15:33
storesnearby.js
/*
curl -H 'Host: mall-store.xsyxsc.com' -H 'accept: application/json, text/plain, */*' -H 'content-type: application/x-www-form-urlencoded' -H 'accept-language: en-us' -H 'user-agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.14(0x17000e2e) NetType/WIFI Language/en' -H 'referer: https://servicewechat.com/wx6025c5470c3cb50c/312/page-frame.html' --data-binary "mapX=114.047012&mapY=22.696412" --compressed 'https://mall-store.xsyxsc.com/mall-store/store/getNearStoreList'
*/
{
"rspCode":"success",
"rspDesc":"",
"data":[
{
"storeId":66880000649923,
{
"rspCode":"success",
"rspDesc":"",
"data":[
{
"orgAreaId":43,
"orgAreaName":"湖南省",
"orgAreaFullName":"湖南省",
"cityCharCode":null,
"level":1,
@thisiswei
thisiswei / landingpage.js
Created May 21, 2021 15:32
landingpage.js
/*
curl -H 'Host: mall.xsyxsc.com' -H 'accept: application/json, text/plain, */*' -H 'content-type: application/json' -H 'origin: https://image.xsyxsc.com' -H 'referer: https://image.xsyxsc.com/item/cms/activityLandingPage/release/20210521/2021052114143131669-1.html?pageCode=2021052114143131669&storeId=66880000772786&storeName=%E5%85%B4%E7%9B%9B%E4%BC%98%E9%80%89%E7%81%BC%E7%8E%89%E5%BA%97&cityCode=3502&areaCode=350203&provinceCode=35&channelUse=WXAPP&saleRegionCode=112&isReport=true&userKey=&v=1.2&isIphoneX=false&t=1621610989604' -H 'userkey: ' -H 'accept-language: en-us' -H 'user-agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.14(0x17000e2e) NetType/WIFI Language/en miniProgram' --data-binary '{"windowName":"十点爆款","areaId":"112","storeId":"66880000772786","includeStoreGroup":true}' --compressed 'https://mall.xsyxsc.com/cms/queryLandingPageProduct'
*/
{
"success": true,
"data": [{
"cmsIndexProductDto": {
"prId": 8
@thisiswei
thisiswei / es6
Last active November 26, 2018 02:58
es6
// https://ponyfoo.com/articles/es6#introduction
> [a, , b] = [0,1,2]
[ 0, 1, 2 ]
> a
0
> b
2
@thisiswei
thisiswei / more-vue.js
Last active November 19, 2018 05:14
more-vue
// why uses vuex?
// because it's easier to track changes
const sourceOfTruth = {}
const vmA = new Vue({
data: sourceOfTruth
})
const vmB = new Vue({
@thisiswei
thisiswei / vue.html
Last active November 18, 2018 19:08
vue-ing
// https://scotch.io/tutorials/implementing-authentication-in-nuxtjs-app
// https://github.com/vuejs/vue-hackernews-2.0
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<div id='app'>
{{message}}
</div>
@thisiswei
thisiswei / vue.js
Last active November 18, 2018 14:51
learning vue
// different hooks:
// - created
// - mounted
// - updated
// - destoryed
new Vue({
data: {
a: 1
},
@thisiswei
thisiswei / create_thumbnail.py
Last active December 21, 2015 18:09
create thumbnails
import re
import logging
import Image
from StringIO import StringIO
MAX_THUMBNAIL_WIDTH = 320.
THUMBNAIL_DIR = 'thumbnails'
IMG_REG_URL = re.compile(r'"(http://s7.jcrew.com/is/image/.*?)\"')
JCREW_URL = 'http://www.jcrew.com/womens_category/shoes.jsp?iNextCategory=-1'
import Image
def create_thumbnail(old_path, new_path):
img = Image.open(old_path)
img.thumbnail((200, 200), Image.ANTIALIAS)
img.save(new_path)