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
public class A { | |
public A() { | |
MainApp.decorateMyClass(this); | |
} | |
} | |
public class B { | |
public B() { | |
MainApp.decorateMyClass(this); | |
} |
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 strict'; | |
const config = require('./knexfile')['development']; | |
const knex = require('knex')(config); | |
const bookshelf = require('bookshelf')(knex); | |
let User = bookshelf.Model.extend({ | |
tableName: 'users', | |
messages: function() { | |
return this.hasMany(Messages); |
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 <tuple> | |
#include <unordered_map> | |
template<typename ...TKeyTypes> | |
struct A { | |
std::tuple<std::unordered_map<TKeyTypes, size_t>...> tupled_maps; | |
}; | |
int main() |
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 <tuple> | |
#include <vector> | |
#include <iostream> | |
#include <utility> | |
template <typename ...Types> | |
struct A | |
{ | |
std::tuple<std::vector<Types>...> t; | |
}; |
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 Worker | |
{ | |
template<typename TProcedure> | |
void execute(TProcedure p); | |
}; | |
struct A | |
{ |
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 <string> | |
#include <iostream> | |
#include <thread> | |
#include <vector> | |
#include <dirent.h> | |
#include <cerrno> | |
struct ScanResult { | |
int returnCode; | |
int errnoCode; |
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 <assert.h> | |
#include <type_traits> | |
template<typename T, typename... Others> | |
struct splitter{ | |
using Head = T; | |
template <template <typename...> typename U> using Tail = U<Others...>; | |
}; | |
int main() { |
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
// Of course we can use something like this [lodash flattenDeep](https://lodash.com/docs/4.17.15#flattenDeep) | |
// but here we want our solution | |
const nestedArray = [[1,2,[3]],4] | |
const moreNestedArray = [1,2,[[[5, 6, [8, [9], [10]]]]]] | |
const flat = array => { | |
return array.reduce( (acc, cur) => | |
typeof cur === 'number' |
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 { enums, GoogleAdsApi, MutateOperation, toMicros } from 'google-ads-api' | |
import { loadGadsCredentialFromFile } from '../gadsCredentialsValidator' | |
import { inspect } from 'util' | |
const cred = { | |
client_id: '', | |
client_secret: '', | |
developer_token: '', | |
refresh_token: '', | |
login_customer_id: '', |