Skip to content

Instantly share code, notes, and snippets.

View lakinwecker's full-sized avatar

Lakin Wecker lakinwecker

  • https://www.structuredabstraction.com
  • Calgary Alberta
View GitHub Profile
#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>;
@lakinwecker
lakinwecker / :mindblown:
Created February 6, 2020 03:10
:mindblown:
// Type your code here, or load an example.
#include <iostream>
using namespace std;
template <typename T>
T square(T num) {
return num * num;
}
#include <iostream>
struct Cell {};
struct DGGS {
virtual void children(Cell *c) = 0;
virtual Cell *child() = 0;
};
struct QuadCell: public Cell {
};
const WrappedTaskItemPage = withUser(
withRemoteData(
{
taskOutcome=withTaskOutcome(match.params.taskId),
taskDefinition=withTaskDefinition(match.params.taskId, match.params.ideaId),
},
TaskItemPage
)
);
[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
type A = {
x: string;
};
type B = {
x?: string;
z: string;
};
type C = A | B;
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({
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
@lakinwecker
lakinwecker / dc.py
Last active September 2, 2019 01:51
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()
#---------------------------------------------------------------------------
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,
)
)