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 <exception> | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
struct GetterOfThings | |
{ | |
virtual ~GetterOfThings() {} |
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 <Poco/Mutex.h> | |
using namespace Poco; | |
class MyClass { | |
public: | |
bool getData() const { | |
Mutex::ScopedLock _l(_mutex); | |
return _data; | |
} |
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> | |
#include <string> | |
using namespace std; | |
struct ConstexprTest | |
{ | |
static bool const s_bool = true ; | |
static int const s_int = 42 ; |
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> | |
#include <string> | |
using namespace std; | |
class MyThing | |
{ | |
public: | |
/* | |
* Have to override default constructor to initialize const and reference members. |
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> | |
#include <vector> | |
#include <cstring> | |
using namespace std; | |
#undef BAD | |
void funcWithNullTerminatedArray(const char* buffer) | |
{ | |
cout << buffer << endl; |
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
settings().minFastlaneVersion = "2.69.3" | |
settings().teamId = "ABCDEFG" | |
settings().myPlugin().pluginSetting = true | |
settings { | |
s in | |
s.minFastlaneVersion = "2.69.3" | |
s.teamId = "ABCDEFG" | |
s.myPlugin { | |
p in |
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
url = "https://www.google.com" | |
content_type = "content-type: application/json" | |
data = %q({"title": "What's New"}) | |
output = sh "curl -X POST #{url.shellescape} -H #{content_type.shellescape} -d #{data.shellescape}" |
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
int i = 0; | |
++ ++ i; // no problem | |
i ++ ++; // doesn't compile | |
/* | |
* It has to do with how these operators work and in particular their return types. The prefix operator returns | |
* the value after modification. The postfix operator returns the value before modification. But how does it do | |
* that? These operators date back to C at least. It's not some background task that happens after the operator | |
* finishes. The prefix operator returns a reference to the same thing (int, object, etc.). The postfix operator | |
* returns a temporary value. It stores the value in a separate location, modifies the value at the original |
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
function findSnowden() { | |
var latitude=-90.0, longitude=-180.0; | |
var delta=1e-5; | |
var found=false; | |
// TODO: Speed up this part | |
while (!found && latitude <= 90.0 && longitude <= 180.0) { | |
var squareMeter = Russia.getRegion(latitude, longitude, 1.0, 1.0); | |
if (squareMeter) { | |
var results = squareMeter.find(function(person) { |
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: http://beginrescueend.com/workflow/scripting/ | |
# Load RVM into a shell session *as a function* | |
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then | |
# First try to load from a user install | |
source "$HOME/.rvm/scripts/rvm" | |
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then | |
# Then try to load from a root install |
NewerOlder