This file contains hidden or 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
| #pragma once | |
| #include "vm.hpp" | |
| namespace entt | |
| { | |
| template<typename Code> | |
| struct vm_encoded | |
| { | |
| memory_buffer opcode; |
This file contains hidden or 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
| ## | |
| # nginx server with http + ssl/https (no WP) | |
| # /etc/nginx/sites-available/example.com | |
| server { | |
| listen 80; | |
| server_name example.com; | |
| location / { | |
| proxy_pass http://no-ssl:8080; | |
| proxy_set_header Host $host; |
This file contains hidden or 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
| // A compile-time method for checking the existence of a class member | |
| // @see https://general-purpose.io/2017/03/10/checking-the-existence-of-a-cpp-class-member-at-compile-time/ | |
| // This code uses "decltype" which, according to http://en.cppreference.com/w/cpp/compiler_support | |
| // should be supported by Clang 2.9+, GCC 4.3+ and MSVC 2010+ (if you have an older compiler, please upgrade :) | |
| // As of "constexpr", if not supported by your compiler, you could try "const" | |
| // or use the value as an inner enum value e.g. enum { value = ... } | |
| // check "test_has_member.cpp" for a usage example |
This file contains hidden or 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
| #pragma once | |
| #include <stdint.h> | |
| //fnv1a 32 and 64 bit hash functions | |
| // key is the data to hash, len is the size of the data (or how much of it to hash against) | |
| // code license: public domain or equivalent | |
| // post: https://notes.underscorediscovery.com/constexpr-fnv1a/ | |
| inline const uint32_t hash_32_fnv1a(const void* key, const uint32_t len) { |
This file contains hidden or 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
| #ifdef SHELL | |
| g++ -Wall -Werror -g -I../../cclib/rapidjson/include $0 && ./a.out | |
| exit 0 | |
| #endif | |
| // Output is: | |
| // {"project":"rapidjson","stars":11} | |
| // {"Name":"XYZ","Rollnumer":2,"array":["hello","world"],"Marks":{"Math":"50","Science":"70","English":"50","Social Science":"70"}} | |
| // {"FromEmail":"sender@gmail.com","FromName":"Sender's name","Subject":"My subject","Recipients":[{"Email":"recipient@gmail.com"}],"Text-part":"this is my text"} |
This file contains hidden or 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
| ## Variables: | |
| # | |
| # OUTPUT_DIRECTORY: Directory where the assemblu file will be placed (For example "/home/manu/listings") | |
| # ASSEMBLY_LISTING_FILE: Assembly listing filename (For example "foo.s") | |
| # SOURCE_FILENAME: Name of the sourcefile being compiled (See bellow). For example "foo", from foo.cpp. | |
| # TARGET: Target being compiled (Mostly an executable target). For example "foo". | |
| if(MSVC) | |
| # Trust me, Microsoft docs suck. | |
| target_compile_options(${TARGET} "/Fa${OUTPUT_PATH}/${ASSEMBLY_LISTING_FILE}" /FA) |
This file contains hidden or 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
| // Bresenham3D | |
| // | |
| // A slightly modified version of the source found at | |
| // http://www.ict.griffith.edu.au/anthony/info/graphics/bresenham.procs | |
| // Provided by Anthony Thyssen, though he does not take credit for the original implementation | |
| // | |
| // It is highly likely that the original Author was Bob Pendelton, as referenced here | |
| // | |
| // ftp://ftp.isc.org/pub/usenet/comp.sources.unix/volume26/line3d | |
| // |
This file contains hidden or 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
| // This is example from | |
| // http://vitiy.info/c11-functional-decomposition-easy-way-to-do-aop/ | |
| // by Victor Laskin | |
| #include <iostream> | |
| #include <functional> | |
| #include <map> | |
| #include <vector> | |
| #include <memory> | |
| #include <chrono> |
This file contains hidden or 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
| var app = require('express')(); | |
| var GridStore = require('mongodb').GridStore; | |
| var ObjectID = require('mongodb').ObjectID; | |
| var MongoClient = require('mongodb').MongoClient; | |
| var Server = require('mongodb').Server; | |
| var dbConnection; | |
| MongoClient.connect("mongodb://localhost:27017/ersatz?auto_reconnect", {journal: true}, function(err, db) { | |
| dbConnection = db; | |
| app.listen(3000); |
NewerOlder