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 <iomanip> | |
#include <iostream> | |
#include <string> | |
#include <type_traits> | |
#include <variant> | |
#include <vector> | |
// the variant to visit | |
using var_t = std::variant<int, long, double, std::string>; | |
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
// Type your code here, or load an example. | |
#include <iostream> | |
using namespace std; | |
template <typename T> | |
T square(T num) { | |
return num * num; | |
} |
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> | |
struct Cell {}; | |
struct DGGS { | |
virtual void children(Cell *c) = 0; | |
virtual Cell *child() = 0; | |
}; | |
struct QuadCell: public Cell { | |
}; |
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
const WrappedTaskItemPage = withUser( | |
withRemoteData( | |
{ | |
taskOutcome=withTaskOutcome(match.params.taskId), | |
taskDefinition=withTaskDefinition(match.params.taskId, match.params.ideaId), | |
}, | |
TaskItemPage | |
) | |
); |
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
[INFO] Running: websocket-server (io.netty.example.http.websocketx.server.WebSocketServer -D_ -Dport=9000) | |
Error: Could not find or load main class | |
Caused by: java.lang.ClassNotFoundException: | |
[ERROR] Failed to execute goal kr.motd.maven:exec-maven-plugin:1.0.0.Final:exec (default-cli) on project netty-example: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1] | |
[ERROR] | |
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. | |
[ERROR] Re-run Maven using the -X switch to enable full debug logging. | |
[ERROR] | |
[ERROR] For more information about the errors and possible solutions, please read the following articles: | |
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException |
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
type A = { | |
x: string; | |
}; | |
type B = { | |
x?: string; | |
z: string; | |
}; | |
type C = 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
import { Injectable } from '@nestjs/common'; | |
import { OAuth2Strategy } from 'passport-google-oauth'; | |
import * as passport from 'passport'; | |
@Injectable() | |
export class GoogleStrategy extends OAuth2Strategy { | |
constructor() { | |
// http://www.passportjs.org/docs/google/ | |
super({ |
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
import Data.Set (delete, fromList, Set) | |
import Data.List (find) | |
import Prelude hiding (iterate) | |
import Text.Printf (printf) | |
-- Produce a cartesian product of 0 to n for each n in a list. | |
cartesianProduct :: (Enum a, Num a) => [a] -> [[a]] | |
cartesianProduct = mapM (enumFromTo 0 . subtract 1) | |
-- Produce a list of all strategies of length 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
import dataclasses | |
import collections | |
import typing | |
@dataclasses.dataclass | |
class Foo: | |
d: typing.DefaultDict[str, int] = dataclasses.field( | |
default_factory=lambda: collections.defaultdict(int)) | |
f = Foo() |
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
#--------------------------------------------------------------------------- | |
def get_queryset(self): | |
qs = self.filter_by_vcs(super().get_queryset()) | |
qs = qs.annotate( | |
postings=Count( | |
'opportunity', | |
filter=Opportunity.objects.active_predicate(), | |
distinct=True, | |
) | |
) |
NewerOlder