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
use std::convert::TryFrom; | |
use thiserror::Error; | |
#[derive(Debug, Error)] | |
enum Error { | |
#[error("Invalid varint")] | |
InvalidVarint, | |
#[error("Invalid wire-type")] | |
InvalidWireType, | |
#[error("Unexpected EOF")] |
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
// TODO: remove this when you're done with your implementation. | |
#![allow(unused_variables, dead_code)] | |
#![allow(dead_code)] | |
pub struct User { | |
name: String, | |
age: u32, | |
height: f32, | |
visit_count: usize, |
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
/// A node in the binary tree. | |
#[derive(Debug)] | |
struct Node<T: Ord> { | |
value: T, | |
left: Subtree<T>, | |
right: Subtree<T>, | |
} | |
/// A possibly-empty subtree. | |
#[derive(Debug)] |
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
//! Splits a string \p str using \p delim. | |
//! \param str An original string. | |
//! \param delim A string delimiter to split. | |
//! \return A splitted string. | |
inline std::vector<std::string> SplitString(const std::string& str, | |
const std::string& delim) | |
{ | |
std::vector<std::string> tokens; | |
std::size_t prev = 0, pos; |
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<stdexcept> | |
template <class T> | |
class SimplePointer { | |
T* ptr; | |
int size; | |
void boundarychk(int idx); | |
public: | |
SimplePointer(); |
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
// ------------------------------------------- SPELL - MAGE | |
// [DRG_321] Rolling Fireball - COST:5 | |
// - Set: Dragons, Rarity: Epic | |
// -------------------------------------------------------- | |
// Text: Deal 8 damage to a minion. Any excess damage | |
// continues to the left or right. | |
// -------------------------------------------------------- | |
// GameTag: | |
// - ImmuneToSpellpower = 1 | |
// -------------------------------------------------------- |
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
// ---------------------------------------- MINION - PRIEST | |
// [DRG_306] Envoy of Lazul - COST:2 [ATK:2/HP:2] | |
// - Set: Dragons, Rarity: Epic | |
// -------------------------------------------------------- | |
// Text: <b>Battlecry:</b> Look at 3 cards. | |
// Guess which one is in your opponent's hand | |
// to get a copy of it. | |
// -------------------------------------------------------- | |
// GameTag: | |
// - BATTLECRY = 1 |
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
class A | |
{ | |
public: | |
static std::unique_ptr<IEffect> AttackN(int n) | |
{ | |
return B::Attack(n); | |
} | |
static std::unique_ptr<IEffect> HealthN(int n) | |
{ |
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
physx::PxVec3* pPxVerts = new physx::PxVec3[list.vertexCount]; | |
for (int i = 0; i < list.vertexCount; i++) | |
{ | |
ConvertPosToPhysX(list.pVerts[i], pPxVerts[i]); | |
} | |
physx::PxU32* pPxIndices = new physx::PxU32[list.triangleCount * 3]; | |
for (int i = 0; i < list.triangleCount * 3; ++i) |
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> | |
int is_morning_good() { | |
const time_t now_seconds = time(NULL); | |
struct tm now; | |
localtime_r(&now_seconds, &now); | |
return (now.tm_hour < 12); | |
} |
NewerOlder