This file contains 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
# Detect architecture | |
if (CMAKE_SIZEOF_VOID_P MATCHES 8) | |
set( PROJECT_ARCH "x86_64" ) | |
else(CMAKE_SIZEOF_VOID_P MATCHES 8) | |
set( PROJECT_ARCH "x86" ) | |
endif(CMAKE_SIZEOF_VOID_P MATCHES 8) | |
# FFmpeg |
This file contains 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
#include <codecvt> | |
using namespace std; | |
#if _MSC_VER >= 1900 | |
wstring_convert<codecvt_utf8<int32_t>, int32_t> utf32conv; | |
auto utf32 = utf32conv.from_bytes("The quick brown fox jumped over the lazy dog."); | |
// use reinterpret_cast<const char32_t *>(utf32.c_str()) | |
#else | |
wstring_convert<codecvt_utf8<char32_t>, char32_t> utf32conv; |
This file contains 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
#include <type_traits> | |
#include <iostream> | |
using std::enable_if; | |
using std::is_same; | |
using std::declval; | |
using std::integral_constant; | |
template <typename T> | |
using Invoke = typename T::type; |
This file contains 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 <future> | |
/** | |
* Class template based on std::async and std::future<> to help in fetching data asynchronously. | |
*/ | |
template <typename T> | |
struct async_data { |
This file contains 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
const std = @import("std"); | |
const c = @cImport({ | |
// @cInclude("imgui/imgui.h"); | |
// @cInclude("imgui/imgui_internal.h"); | |
@cInclude("imgui/imstb_truetype.h"); | |
@cInclude("imgui/imstb_rectpack.h"); | |
}); | |
const assert = std.debug.assert; |
This file contains 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
"use strict"; | |
var path = require('path'); | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
express: { | |
defaults: { | |
options: { | |
port: 3000, |
This file contains 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 express = require('express') | |
, path = require('path') | |
, stylus = require('stylus') | |
, nib = require('nib') | |
, mongoose = require('mongoose'); | |
var app = express(); | |
app.locals.title = 'My Web App'; |
This file contains 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
"use strict"; | |
var pending_asops = 0; | |
var global_data; | |
startingAsop(); | |
asyncFunction('param1', 'param2', function(err, data) { global_data = data; } ); | |
function allDone() { | |
// Use the complete data! |
This file contains 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
class FilePtr { | |
public: | |
FilePtr() { fp = nullptr; } | |
FilePtr(FILE *fp_) { fp = fp_; } | |
FilePtr & operator = (FILE *fp_) { assert(fp == nullptr); fp = fp_; return *this; } | |
~FilePtr() { if (fp != nullptr) fclose(fp); } | |
operator FILE * () { return fp; } | |
private: | |
FILE *fp; | |
}; |
This file contains 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 index = ... hash of id => filename | |
return _.reduce(index, function(seq, filename, id) { | |
return seq.then( function() { return fs.read(filename); } ) | |
}, Q.resolve()); |
NewerOlder