Skip to content

Instantly share code, notes, and snippets.

View ubaidh's full-sized avatar

ubaid khatlani ubaidh

  • microminds
  • kashmir
  • 09:25 (UTC +05:30)
View GitHub Profile
@ubaidh
ubaidh / fetch-api-examples.md
Last active October 7, 2020 20:39 — forked from justsml/fetch-api-examples.md
JavaScript Fetch API Examples
@ubaidh
ubaidh / nodejs-cheatsheet.js
Created October 6, 2020 17:49 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
[
{
"movie_title": "Avatar ",
"director_name": "James Cameron",
"actor_1_name": "CCH Pounder",
"actor_2_name": "Joel David Moore",
"genres": "Action|Adventure|Fantasy|Sci-Fi",
"language": "English",
"country": "USA",
"content_rating": "PG-13",
#include<tuple>
#include<string>
#include<iostream>
int main() {
std::tuple<int, std::string, char> t(3, "hello world", 'a');
std::cout << std::get<0>(t) << std::endl;
std::cout << std::get<1>(t) << std::endl;
std::cout << std::get<2>(t) << std::endl;
std::cout <<" \n";
#include<iostream>
#include<random>
#include<chrono>
#include<vector>
#include<string>
int main(int argc, char**agrv) {
auto seed = std::chrono::steady_clock::now().time_since_epoch().count();
std::default_random_engine eng(seed);
std::cout << eng()<<std::endl;
std::uniform_int_distribution<int> distr(0, 10);
@ubaidh
ubaidh / 02-randomfunc.cpp
Created January 7, 2019 15:25
<random> function to print random numbers
#include<iostream>
#include<random>
void printrandom(std::default_random_engine e) {
for (int i = 0; i < 10; i++) {
std::cout << e() << " ";
}
std::cout << "\n";
}
int main(int argc, char**agrv) {
std::default_random_engine eng;
@ubaidh
ubaidh / 01-random.cpp
Last active July 28, 2020 14:30
<random>
#include<iostream>
#include<random>
int main(int argc, char**agrv) { //stateful generator with predefined min and max
std::default_random_engine eng; //std::default_random_engine random number engine class that generates pseudo-random numbers.
std::cout << "min :"<<eng.min() << "\n"; // min value
std::cout << "max :"<<eng.max() <<"\n"; //max value
std::cout << "random number :" << eng() << "\n"; //pseudorandom number
std::cin.get();
return 0;
}