Skip to content

Instantly share code, notes, and snippets.

View sohale's full-sized avatar
😅

Sohail Siadat sohale

😅
View GitHub Profile
@sohale
sohale / cpp_stl_sheet.cpp
Last active October 11, 2016 11:17
Example usage of STL libraries, for quick review and reference
void vector_capacity_reserve() {
// How to set the capacity of a vector?
// .reserve()
std::vector<int> new_faces;
new_faces.reserve(1000);
assert(new_faces.size() == 0)
}
@sohale
sohale / thread_example1.cpp
Created September 29, 2016 15:46
A simple Thread experiment in C++
/*
Copyright Sohail 2016
This visualises how the actual order of execution varies in a multi-threaded program, in a practical situation.
A central problem in multithreaded is the fact that we cannot predict (and there is absolutely no guarantee regarding) the sequence in which the actual execution is performed.
Features example use of std::thread(), std::mutex, std::unique_lock<>, and the methods join(), sleep_for(), sleep_until().
Four simple experiments in multi-thread programming in C++11/14.
The 4 Experiments in the reverse order:
@sohale
sohale / rxjs_example1.html
Last active September 29, 2016 15:51
A very simple example usage of RxJS 5 to get the idea of what is does.
<!DOCTYPE html>
<!-- Playing with RxJS 5.0 -->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Buffer</title>
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.3/dist/global/Rx.umd.js"></script>
</head>
<body>