You may need to configure a proxy server if you're having trouble cloning
or fetching from a remote repository or getting an error
like unable to access '...' Couldn't resolve host '...'
.
Consider something like:
const newGuid = Date.now().toString(36) + Math.random().toString(36).substring(2); | |
export default newGuid; |
function transform(hint) { | |
return hint == 'string' ? this.name : this.height | |
} | |
let man = { | |
name: 'Evgeniy', | |
height: 185, | |
[Symbol.toPrimitive]: transform | |
} |
Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080
. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.
When you do git clone ssh://[user@]server/project.git
or git clone [user@]server:project.git
, you're using the SSH protocal. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config
:
ProxyCommand nc -x localhost:1080 %h %p
sysLog = new EventLog(); | |
sysLog.Log = "System"; | |
IEnumerable<EventLogEntry> Entries = sysLog.Entries.Cast<EventLogEntry>(); | |
// время первого события текущего дня | |
var startTime = | |
(from l in Entries | |
where l.TimeGenerated.DayOfYear == nowTime.DayOfYear // только события сегодняшнего дня | |
select l.TimeGenerated) | |
.Min(); |
//boilerplate code: async GET Requests | |
//The async keyword will ensure that the function returns a promise. | |
const getData = async () => { | |
try { | |
const response = await fetch('https://api-to-call.com/endpoint'); | |
if (response.ok) { | |
//Since .json() is an asynchronous method we have to await until the promise status is resolved. Then we store the value to know what data the JSON holds. | |
const jsonResponse = await response.json(); | |
return jsonResponse; |
//The boilerplate code for an AJAX POST request using fetch. | |
fetch('https://api-to-call.com/endpoint', { | |
method: 'POST', | |
body: JSON.stringify({id: '200'}) | |
}).then( response => { | |
if (response.ok) { | |
return response.json(); | |
} | |
throw new Error('Request failed!'); |
// boilerplate code necessary to create a GET request using the fetch() | |
fetch('https://api-to-call.com/endpoint').then(response => { | |
if (response.ok) { | |
return response.json(); | |
} | |
throw new Error('Request failed!'); | |
}, networkError => { | |
console.log(networkError.message); | |
}).then( jsonResponse => { |
//The boilerplate code for an AJAX POST request using an XMLHttpRequest object. | |
//The XMLHttpRequest object is used in JavaScript to interact with servers. | |
const xhr = new XMLHttpRequest(); | |
//The URL will direct the request to the correct server. | |
const url = 'https://api-to-call.com/endpoint'; | |
//JSON.stringify() will convert a value to a JSON string. | |
//By converting the value to a string, we can then send the data to a server. | |
const data = JSON.stringify({id: '200'}); |
<!DOCTYPE html> | |
<html lang="en" dir="ltr"> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
</head> | |
<body> | |
</body> | |
</html> |