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
-- Stack (for Lua 5.1)#http://snippets.luacode.org/snippets/stack_97 | |
function NewStack(t) | |
local Stack = { | |
push = function(self, ...) | |
for _, v in ipairs{...} do | |
self[#self+1] = v | |
end | |
end, | |
pop = function(self, num) |
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
final AssetBitmapTextureAtlasSource sourceAtlas = AssetBitmapTextureAtlasSource.create(getAssets(), path); | |
int width = sourceAtlas.getTextureWidth(); | |
int height = sourceAtlas.getTextureHeight(); | |
BitmapTextureAtlas atlas = new BitmapTextureAtlas(getTextureManager(), width, height); | |
TiledTextureRegion texture = BitmapTextureAtlasTextureRegionFactory.createTiledFromSource( | |
atlas, | |
new ColorKeyBitmapTextureAtlasSourceDecorator(sourceAtlas, RectangleBitmapTextureAtlasSourceDecoratorShape | |
.getDefaultInstance(), android.graphics.Color.rgb(255, 0, 255)), 0, 0, width / tileWidth, height / tileHeight); |
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 <iostream> | |
#include <vector> | |
#include <functional> | |
class WorkingClass { | |
public: | |
typedef const std::function<void (int)> handler_t; | |
void AddHandler(handler_t& h) { | |
handlerList.push_back(&h); | |
} |
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 <boost/format.hpp> | |
void LogMessage(boost::format& message) { | |
std::cout << message.str() << std::endl; | |
} | |
template<typename TValue, typename... TArgs> | |
void LogMessage(boost::format& message, TValue arg, TArgs... args) { | |
message % arg; | |
LogMessage(message, args...); |
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
/* | |
Code page 437 is the charset used by the original IBM PC, | |
it includes a wide variety of graphical symbols for ascii | |
drawings. | |
In this implementation I define unicode code points that | |
match the original cp437 symbols. The table also includes | |
the unique character name and if available the 7-bit | |
US-ASCII character. |
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
int main(int argc, char **argv) { | |
int num = 42; | |
// marks value the ptr is refering as constant | |
const int *p1 = # | |
// (*p1)++; // illegal | |
p1++; // legal | |
/////////////////////////////////////////////////// |
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
public void onNewItems(List<Item> newItems) { | |
notifyDataSetChanged(); | |
} //just a test |
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
ffmpeg \ | |
-i INPUT_FILE \ | |
-re \ | |
-r 23.976 \ | |
-s 480x204 \ | |
-aspect 2.35 \ | |
-acodec libfaac \ | |
-ac 2 \ | |
-ar 44100 \ | |
-ab 128k \ |
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 fs = require('fs'), | |
util = require('util'), | |
Stream = require('stream').Stream; | |
/** | |
* Create a bandwidth limited stream | |
* | |
* This is a read+writeable stream that can limit how fast it | |
* is written onto by emitting pause and resume events to | |
* maintain a specified bandwidth limit, that limit can |
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
" stop using arrow keys! | |
map <UP> d'oh! | |
map <DOWN> d'oh! | |
map <LEFT> d'oh! | |
map <RIGHT> d'oh! | |
imap <UP> d'oh! | |
imap <DOWN> d'oh! | |
imap <LEFT> d'oh! | |
imap <RIGHT> d'oh! |