package main
import (
"crypto/md5"
//"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
This file contains 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
const base64 = 'data:image/png;base65,....' // Place your base64 url here. | |
fetch(base64) | |
.then(res => res.blob()) | |
.then(blob => { | |
const fd = new FormData(); | |
const file = new File([blob], "filename.jpeg"); | |
fd.append('image', file) | |
// Let's upload the file | |
// Don't set contentType manually → https://github.com/github/fetch/issues/505#issuecomment-293064470 |
-
Mac OS X
system settings
>Security & Privacy
>privacy
tab -
Select Full Disk Access and click plus icon.
-
Add terminal in the list ( in my case iTerm)
-
Restart iTerm
-
Run command in iterm:
$ cd /private/etc && sudo touch ./exports
-
Start virtual machine trough vargrant: Profit
This file contains 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
# Open Terminal | |
vim ~/.vimrc | |
# Mac OS-X -> .vimrc ; Window -> .gvimrc | |
# Add it in the file and adjust the font size (h12) accordingly | |
set guifont=Menlo\ Regular:h15 |
This file contains 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
/** | |
* PHP's curl extension won't let you pass in strings as multipart file upload bodies; you | |
* have to direct it at an existing file (either with deprecated @ syntax or the CURLFile | |
* type). You can use php://temp to get around this for one file, but if you want to upload | |
* multiple files then you've got a bit more work. | |
* | |
* This function manually constructs the multipart request body from strings and injects it | |
* into the supplied curl handle, with no need to touch the file system. | |
* | |
* @param $ch resource curl handle |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<video></video> | |
<br/> | |
<input type="file" name="file" id="fileItem" onchange="onChange()" > |
This file contains 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
<?php | |
// FOLLOW A SINGLE REDIRECT: | |
// This makes a single request and reads the "Location" header to determine the | |
// destination. It doesn't check if that location is valid or not. | |
function get_redirect_target($url) | |
{ | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
curl_setopt($ch, CURLOPT_NOBODY, 1); |
This file contains 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
一、数组操作的基本函数 | |
数组的键名和值 | |
array_values($arr); 获得数组的值 | |
array_keys($arr); 获得数组的键名 | |
array_flip($arr); 数组中的值与键名互换(如果有重复前面的会被后面的覆盖) | |
in_array("apple",$arr); 在数组中检索apple | |
array_search("apple",$arr); 在数组中检索apple ,如果存在返回键名 | |
array_key_exists("apple",$arr); 检索给定的键名是否存在数组中 | |
isset($arr[apple]): 检索给定的键名是否存在数组中 | |
数组的内部指针 |
This file contains 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
<?php | |
/** | |
* PHP数组不定长多键值排序 | |
* | |
* @author Zjmainstay | |
* @website http://www.zjmainstay.cn, https://glot.io/snippets/ernfkfnjhb | |
* @param array $list 数据源 | |
* @param array $rules 排序规则 ['key1'=>'asc', 'key2' => 'desc', ...] | |
* @return array | |
*/ |