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
/* fallback */ | |
template<class T> | |
T lexical_cast(const char* str) | |
{ | |
static std::istringstream ss; /* reusing has severe (positive) impact on performance */ | |
T value; | |
ss.str(str); | |
ss >> value; | |
ss.clear(); | |
return value; |
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
{ | |
"targets": [ | |
{ | |
"target_name": "promises", | |
"sources": ["promises.cpp"], | |
"include_dirs": ["<!(node -e \"require('nan')\")"] | |
} | |
] | |
} |
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
#!/usr/bin/bash | |
# usage: sh convert_sprites.sh <list of sprite dirs> | |
for dir in $@; do | |
convert \ | |
\( $(find $dir ! -name '*_template.png' -type f | sort) -append \) \ | |
\( $(find $dir -name '*_template.png' -type f | sort) -append \) \ | |
-background none +append $(basename $dir).png | |
shift | |
done |
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
#include <iostream> | |
template<typename T> | |
int sum(T v) { | |
return v; | |
} | |
template<typename T, typename... Types> | |
int sum(T v, Types&&... others) { | |
return v + sum(others...); |
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
#include <algorithm> | |
#include <cstdint> | |
#include <iostream> | |
#include <iterator> | |
#include <limits> | |
#include <vector> | |
int main(int argc, char** argv) { | |
auto n = 100000U; | |
auto sieve = std::vector<uint32_t>(n); |
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
From 8e70099afb04023b40f1ac4c4ac999cc22d11def Mon Sep 17 00:00:00 2001 | |
From: Ranieri Althoff <[email protected]> | |
Date: Mon, 20 Jul 2015 03:15:34 -0300 | |
Subject: [PATCH] Enable monster passive behavior | |
--- | |
src/luascript.cpp | 13 +++++++++++++ | |
src/luascript.h | 1 + | |
src/monster.cpp | 4 ++++ | |
src/monster.h | 3 +++ |
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
local TYPE_ITEM, TYPE_MONSTER, TYPE_NPC = 0, 2, 3 | |
local config = { | |
[5907] = { | |
name = 'bear', | |
id = 3, | |
type = TYPE_MONSTER, | |
chance = 20, | |
fail = { | |
{run = true, text = 'The bear ran away.'}, |
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
local ITEM_MAGIC_WORM = 10224 | |
local config = { | |
peixes = { | |
leveis = { 20, 40, 50, 60, 80, 100, 120 }, | |
fish = { | |
[20] = 2670, -- 4 | |
[40] = 2667, -- 8 | |
[60] = 7159, -- 16 | |
[80] = 7158, -- 20 |
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
From d71d1eaa007b6f6d552eb7566572ce52f6ad1bc8 Mon Sep 17 00:00:00 2001 | |
From: Ranieri Althoff <[email protected]> | |
Date: Wed, 15 Jul 2015 15:41:11 -0300 | |
Subject: [PATCH] Move bug report to Lua | |
--- | |
data/creaturescripts/creaturescripts.xml | 1 + | |
data/creaturescripts/scripts/report.lua | 26 +++++++++++++++++++++ | |
src/creatureevent.cpp | 40 ++++++++++++++++++++++++++++++++ | |
src/creatureevent.h | 3 +++ |
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
#include <cstdint> | |
#include <iostream> | |
#include <iomanip> | |
#include "fft.h" | |
FFT::FFT(const std::string& filename) | |
: file(filename, std::ifstream::binary) | |
{ | |
int32_t chunk_id; | |
file.read(reinterpret_cast<char*>(&chunk_id), 4); |