Skip to content

Instantly share code, notes, and snippets.

Avatar

Anton Bikineev AntonBikineev

View GitHub Profile
View builtins-date-based-on-std-stringstream.cc
// ES6 section 20.3.4.41.1 ToDateString(tv)
std::string ToDateString(double time_val, DateCache* date_cache,
ToDateStringMode mode = kDateAndTime) {
std::stringstream ss;
ss.sync_with_stdio(false); // to speed up by enabling buffering
if (std::isnan(time_val)) {
ss << "Invalid Date";
return ss.str();
}
int64_t time_ms = static_cast<int64_t>(time_val);
View 1.sql
SELECT Клиент.ФИО, SUM(ТоварыЗаказа.Цена)
FROM Клиент
INNER JOIN Заказ ON Клиент.КлиентID = Заказ.КлиентID
INNER JOIN ТоварыЗаказа ON ТоварыЗаказа.ЗаказID = Заказ.ЗаказID
WHERE Заказ.Дата >= '2013-12-01' AND
Заказ.Дата <= '2013-12-31'
GROUP BY Клиент.КлиентID
HAVING SUM(ТоварыЗаказа.Цена) >= 10000;
View serialization_tuple.cpp
#include <hpx/util/tuple.hpp>
#include <hpx/runtime/serialization/serialize.hpp>
#include <hpx/runtime/naming/name.hpp>
int main()
{
std::vector<char> buf;
{
hpx::serialization::output_archive oar{buf};
hpx::util::tuple<hpx::naming::gid_type> tuple =
View some.cpp
#include <vector>
#include <numeric>
#include <algorithm>
#include <hpx/include/serialization.hpp>
#include <hpx/util/lightweight_test.hpp>
int main()
{
static constexpr auto vector_size = HPX_ZERO_COPY_SERIALIZATION_THRESHOLD + 1u;
View ub.cc
template <class T>
auto futurized(const T& t)
{
auto fut = hpx::async(...);
return fut.then(
[&t](auto){...});
}
int main()
{
View transform.cpp
using namespace hpx::parallel;
std::vector<int> vec(20), vec1(20);
std::iota(std::begin(vec), std::end(vec), 0);
transform(std::cbegin(vec), std::cend(vec), std::begin(vec1), [](int n){ return n * 2; });
View gist:9cc93cb84dfe1d96129c
template <class T, class = void>
struct has_something: std::false_type {};
template <class T>
struct has_something<T, void_t<decltype(std::declval<T>().something)> > : std::true_type
{
};
View run.rb
#!/usr/bin/env ruby
require './color.rb'
require './os.rb'
def read_int_param(name, default)
param = default
if(ARGV.include?(name))
idx = ARGV.index(name)
param = ARGV[idx+1].to_i
ARGV.delete_at(idx)
@AntonBikineev
AntonBikineev / diff
Created Feb 11, 2015
CMakeList diff
View diff
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9460024..aa82dae 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,7 +6,7 @@
add_subdirectory(components)
-foreach(lib "hpx hpx_serialization")
+foreach(lib "hpx")