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
| # For Safety | |
| add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; | |
| add_header Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'" always; | |
| add_header X-Frame-Options "SAMEORIGIN" always; | |
| add_header X-Xss-Protection "1; mode=block" always; | |
| add_header X-Content-Type-Options "nosniff" always; | |
| server_tokens off; | |
| add_header Referrer-Policy "no-referrer-when-downgrade"; | |
| add_header Feature-Policy "midi none;notifications none;push none;sync-xhr none;microphone none;camera none;magnetometer none;gyroscope none;speaker self;vibrate none;fullscreen self;payment none;"; | |
| # Sources: |
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
| // This is written in Pug syntax. not HTML. but same thing. Pug would compile to HTML | |
| template(v-for='(l, index) in list') | |
| topic-card(:topic='t', :key='t.id') | |
| template(v-if='index == 2') | |
| // [IMPORTANT: display your specifial element here] |
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
| http://1c7.me/2018-8-31-fix-base64-img-in-database-to-url/ |
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 { routerRedux } from 'dva/router'; | |
| export default class Analysis extends Component { | |
| // ============== | |
| toUserList = () => { | |
| const { dispatch } = this.props; | |
| dispatch(routerRedux.push('/list/user-list')); | |
| }; | |
| // ============== | |
| render(){ |
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
| # Python 3 | |
| import base64 | |
| # Fill in this | |
| base64_string = 'data:image/jpeg;base64, ...etc..' | |
| array = url.split('data:image/jpeg;base64,') | |
| base64_naked = array[1] | |
| imgdata = base64.b64decode(base64_naked) | |
| with open('haha.jpg', 'wb') as f: |
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 API_common from '@/api/common' | |
| // 上传文件到七牛 | |
| // 这个函数用到了另外2个函数:get_upload_token, qiniu_upload | |
| function upload(user_id, file, progress_callback){ | |
| return new Promise(function (resolve, reject) { | |
| get_upload_token().then(token=>{ | |
| resolve(token); |
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
| ## What you need | |
| 1. youtube-dl | |
| 2. aria2 | |
| 3. Proxy(if you live in Country like China) | |
| ## Run this in command line | |
| export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087; | |
| youtube-dl --external-downloader aria2c --external-downloader-args "-x 16 -k 1M" https://www.youtube.com/watch?v=rAeN7TdGq4o |
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
| Vue.filter('fm-truncate', function (value, length) { | |
| if (!value) return '' | |
| value = value.toString() | |
| if(value.length > length){ | |
| return value.substring(0, length) + "..." | |
| }else{ | |
| return value | |
| } | |
| }) |
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
| ```bash | |
| set http_proxy=http://127.0.0.1:1080;export https_proxy=http://127.0.0.1:1080; | |
| ``` |
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 RNFetchBlob from 'react-native-fetch-blob'; | |
| import RNFS from'react-native-fs'; | |
| let dirs = RNFetchBlob.fs.dirs | |
| const file_path = dirs.DCIMDir + '/' + 'wechat.jpg'; | |
| RNFS.copyFileAssets('wechat.jpg', file_path) | |
| .then(() => { | |
| RNFetchBlob.fs.scanFile([{ path: file_path }]) | |
| }) | |
| .catch((error) => console.log(error)); |