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
/* | |
* This function will replace the content inside | |
* the commentary "setupVars" | |
* | |
* Param: | |
* content: the input string, e.g, a entire HTML file | |
* data: snippet to be included | |
* | |
* <html> | |
* <body> |
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
typedef int myinterger; | |
typedef int (*fn_adder)(int, long); | |
int sum(int a, long b){ | |
return a+b; | |
} |
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
function throttle( fn, time ) { | |
var t = 0; | |
return function() { | |
var args = arguments, ctx = this; | |
clearTimeout(t); | |
t = setTimeout( function() { | |
fn.apply( ctx, args ); | |
}, time ); | |
}; |
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
void Foo( int * ptr, | |
int const * ptrToConst, | |
int * const constPtr, | |
int const * const constPtrToConst ) | |
{ | |
*ptr = 0; // OK: modifies the "pointee" data | |
ptr = NULL; // OK: modifies the pointer | |
*ptrToConst = 0; // Error! Cannot modify the "pointee" data | |
ptrToConst = NULL; // OK: modifies the pointer |
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
using namespace foo; //generic, the same behaviour in Java, include com.foo.* | |
using bar;// specific, the same behaviour in Java, include com.package.bar; |
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
http://stackoverflow.com/questions/2898316/using-a-member-function-pointer-within-a-class | |
//char *buffer = new char[bufferSize]; | |
std::string buffer; | |
buffer.resize(bufferSize); |
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 <ctime> | |
#include <iostream> | |
#include <boost/date_time/gregorian/gregorian.hpp> | |
#include <boost/date_time/posix_time/posix_time.hpp> | |
//============================================================================== | |
//! Convert date part of Unix timestamp (time_t) to boost date | |
//! |
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 <cpprest/json.h> | |
#include <sstream> | |
using namespace std; | |
typedef web::json::value JsonValue; | |
typedef web::json::value::value_type JsonValueType; | |
typedef std::wstring String; | |
typedef std::wstringstream StringStream; | |
String JsonValueTypeToString(const JsonValueType& 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
var fs = require('fs'), | |
omggif = require('omggif'), | |
THREE = require('three'), | |
SoftwareRenderer = require('three-software-renderer'); | |
// How many frames and how large shall the GIF be? | |
var NUM_FRAMES = 200, WIDTH = 500, HEIGHT = 500; | |
// Our scene, camera and renderer and a box to render | |
var scene = new THREE.Scene(), |
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 mongoose = require('./index') | |
, TempSchema = new mongoose.Schema({ | |
salutation: {type: String, enum: ['Mr.', 'Mrs.', 'Ms.']} | |
}); | |
var Temp = mongoose.model('Temp', TempSchema); | |
console.log(Temp.schema.path('salutation').enumValues); | |
var temp = new Temp(); | |
console.log(temp.schema.path('salutation').enumValues); |
OlderNewer