Skip to content

Instantly share code, notes, and snippets.

⚙️
Updating

_Mark24_(张阳) Mark24Code

⚙️
Updating
Block or report user

Report or block Mark24Code

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:94faddf82d4fde234fb26f01072773c2
git log --numstat --pretty="%H" <HashStart>..<HashEnd> | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d,-%d\n",plus,minus)}'\n
@Mark24Code
Mark24Code / README.md
Created Apr 8, 2018 — forked from datagrok/README.md
Circular imports in Python 2 and Python 3: when are they fatal? When do they work?
View README.md

When are Python circular imports fatal?

In your Python package, you have:

  • an __init__.py that designates this as a Python package
  • a module_a.py, containing a function action_a() that references an attribute (like a function or variable) in module_b.py, and
  • a module_b.py, containing a function action_b() that references an attribute (like a function or variable) in module_a.py.

This situation can introduce a circular import error: module_a attempts to import module_b, but can't, because module_b needs to import module_a, which is in the process of being interpreted.

But, sometimes Python is magic, and code that looks like it should cause this circular import error works just fine!

@Mark24Code
Mark24Code / unorderArr.js
Created Jan 10, 2018
乱序数组算法
View unorderArr.js
function unorderArr(arr){
let carr = arr.concat();
carr.sort(function(x,y){
return 0.5-Math.random()
})
return carr
}
@Mark24Code
Mark24Code / base64toBob&AxiosUploadFile.js
Last active Jan 10, 2018
base64转文件,axios上传文件(适用于裁剪头像上传)
View base64toBob&AxiosUploadFile.js
//base64转 bob文件
function dataURItoBlob(dataURI) {
// convert base64/URLEncoded data component to raw binary data held in a string
var byteString;
if (dataURI.split(',')[0].indexOf('base64') >= 0)
byteString = atob(dataURI.split(',')[1]);
else
byteString = unescape(dataURI.split(',')[1]);
// separate out the mime component
View mover.py
# encoding: utf-8
"""
搬运工Mover
列表一一对应,搬运文件
Windows下要注意,硬盘符号要写成C:\\,Win下Unicode的问题
author: mark24
email: mark.zhangyoung@qq.com
date: 2017.08.09
@Mark24Code
Mark24Code / README.txt
Last active Jul 17, 2017
基于Vue-cli多页面Build
View README.txt
webpack.prod.conf.js
添加的自定义函数
filename:编译后的目标文件,相对路径是 dist
template:明确的模板,相对路径是 项目根目录
然后,来源,是 entry一一对应的入口(这是隐藏的)
大原则,就是,和 webpack.base.config.js的Entry一一对应
View 转换px到rem函数
import re
newlines = []
with open('ff','r',encoding='UTF-8') as f:
lines = f.readlines()
for line in lines:
m = re.search(r'.+: (\d.px).+',line)
newline = ''
if m:
@Mark24Code
Mark24Code / cooker.py
Last active Jun 23, 2017
煮粥电饭煲计算预约时间
View cooker.py
# -*- coding: utf-8 -*-
"""用于计算煮,粥预约时间"""
from datetime import datetime, timedelta, date
now_datetime = datetime.now()
cook_what = 'zhou' #
cooked_time = '6:00:00' # 次日时间
cook_menu = {
@Mark24Code
Mark24Code / _base.scss
Created Jun 5, 2017
微信小程序Gulp & Sass
View _base.scss
@charset "UTF-8";
@function rpx($v) {
@return $v/1px * 1rpx;
}
@Mark24Code
Mark24Code / eleme.py
Created May 8, 2017 — forked from SaulLawliet/eleme.py
查询饿了么品牌馆中有哪些是 <真·五折>
View eleme.py
# coding: utf-8
import json
import re
import requests
# 替换成你自己的经纬度数据
# 查询方式 打开饿了么官网 -> 开发者模式 -> 输入送餐地址 -> 观察请求 -> 找到经纬度数据
latitude = 31.23978
longitude = 121.49968
You can’t perform that action at this time.