factorial | ratio |
---|---|
1 | |
2 | 2x |
3 | 1.5x |
5 | 1.7x |
8 | 1.6x |
13 | 1.6x |
20 | 1.5x |
40 | 2x |
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
#!/usr/bin/env python | |
import argparse | |
from P4 import P4 | |
p4 = P4() | |
p4.connect() | |
def main(): | |
argparse.ArgumentParser(description="Verify that all files synced to the same changelist, and sets ERRORLEVEL to the count of unsynced files.").parse_args() | |
client = p4.fetch_client()['Client'] |
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
namespace CPPUNIT_NS | |
{ | |
template <template <typename...> class C, typename... T> struct assertion_traits<C<T...>> | |
{ | |
inline static bool equal(C<T...> const& left, C<T...> const& right) | |
{ | |
return std::equal( | |
left.cbegin(), left.cend(), right.cbegin(), assertion_traits<decltype(*(left.cbegin()))>::equal); | |
} |
I propose a refactoring "Extract Open Source Project".
We build software systems to some purpose. But when I read code, I see that some of that code directly serves that purpose while other code does not. I see three categories:
This is the stuff you and your customers care about. It's the reason your software system exists.
In an e-commerce system, that's code that says "when a customer uses a discount code, the discount is applied to the order."
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
public class MyViewModel : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged = delegate {}; | |
string _name; | |
public string Name | |
{ | |
get { return _name; } | |
set | |
{ |
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
vector<Card> cards = ... | |
for (i = 0; i < cards.length(); i++) | |
{ | |
Assert(card[i].value == i % 13); | |
Assert(card[i].suit == i / 13); | |
} |
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
#define Example(name) Example_(name, __COUNTER__) | |
#define Example_(name, counter) Example__(name, counter) | |
#define Example__(name, counter) \ | |
void Example##counter(); \ | |
struct ExampleInitializer##counter \ | |
{ \ | |
ExampleInitializer##counter() \ | |
{ \ | |
allExamples.Add({__FILE__, name, Example##counter}); \ | |
} \ |
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
#define Example(name, body) Example_(name, body, __COUNTER__) | |
#define Example_(name, body, counter) Example__(name, body, counter) | |
#define Example__(name, body, counter) \ | |
struct ExampleInitializer##counter \ | |
{ \ | |
ExampleInitializer##counter() \ | |
{ \ | |
allExamples.Add({__FILE__, name, body}); \ | |
} \ | |
} ExampleInitializer##counter##Instance; \ |
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 F(...) | |
{ | |
// ... | |
if (...) | |
/* start */ | |
{ | |
if (...) | |
{ | |
// ... |
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
// Given: | |
Y y = ... | |
Action action = () => { | |
var x = F(y); | |
G(x); | |
}; | |
action(); |