start new:
tmux
start new with session name:
tmux new -s myname
*.pbxproj -crlf -diff -merge |
-- [Lua] The classic card game, War (v.2.1) -- | |
TheDeck = {} | |
carddeck = {} | |
player = { hand={} } | |
opponent = { hand={} } | |
arena = { hand={} } | |
-- Standard seed based on time, called once | |
math.randomseed(os.time()) |
#include <iostream> | |
using namespace std; | |
bool isPalindrome(const char* inText) | |
{ | |
if (!inText || !*inText) | |
return false; // Empty strings fail. OK? | |
const char* a = inText - 1; | |
const char* b = inText; |
<?php | |
/* From https://www.usps.com/send/official-abbreviations.htm */ | |
$us_state_abbrevs_names = array( | |
'AL'=>'ALABAMA', | |
'AK'=>'ALASKA', | |
'AS'=>'AMERICAN SAMOA', | |
'AZ'=>'ARIZONA', | |
'AR'=>'ARKANSAS', |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
#include "SSLBuffer.h" | |
SSLBuffer::SSLBuffer() | |
:ssl(NULL) | |
,read_bio(NULL) | |
,write_bio(NULL) | |
,write_to_socket_callback(NULL) | |
,write_to_socket_callback_data(NULL) | |
,read_decrypted_callback(NULL) | |
,read_decrypted_callback_data(NULL) |
// Class for non-nullable pointers | |
template<class T> | |
class ptr | |
{ | |
private: | |
T* m_ptr; | |
ptr(nullptr_t); // avoids init with nullptr | |
ptr(int); // avoids init with 0 or NULL | |
public: | |
explicit ptr(T* ptr) throw() : m_ptr(ptr) { assert(ptr != nullptr); }; |
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
#include <iostream> | |
#include <random> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
enum suits {SPADES, DIAMONDS, CLUBS, HEARTS}; | |
enum modes {ACES_LOW, ACES_HIGH}; |