Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert Schönthal digitalkaoz

View GitHub Profile
View rechentrainer.json
{"schemaVersion":1,"label":"Test Coverage","message":"93.2%","color":"green"}
@digitalkaoz
digitalkaoz / model.py
Last active Dec 25, 2020
SQL Alchemy Many To Many Relation delete cascading
View model.py
# domain model
class Company(base):
id: int = Column(BigInteger, primary_key=True, autoincrement=True)
addresses = relationship("CompanyAddress", backref=backref("company",cascade='all,delete-orphan'))
class User(base):
id: int = Column(BigInteger, primary_key=True, autoincrement=True)
addresses = relationship("UserAddress", backref=backref("user",cascade='all,delete-orphan'))
class Address(base):
View gist:0e7b04a1badcc45fbb93b1026397c9c7
[ +33 ms] executing: [/opt/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +47 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 67826bdce54505760fe83b7ead70bdb5af6fe9f2
[ ] executing: [/opt/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +99 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v1.15.3-0-g67826bdce
[ +9 ms] executing: [/opt/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +9 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/dev
[ ] executing: [/opt/flutter/] git ls-remote --get-url origin
@digitalkaoz
digitalkaoz / app.dart
Last active Feb 5, 2020
Flutter mobx state problem
View app.dart
final List<InheritedProvider> providers = [
Provider<Api>(create: (_) => Api()),
Provider<X>(create: (_) => X()),
Provider<Y>(create: (_) => Y()),
ProxyProvider3<Api, X, Y, AppData>(
update: (_, api, x, y, __) => AppData(api, x, y),
),
];
class MyApp extends StatelessWidget {
@digitalkaoz
digitalkaoz / dep.scss
Created Mar 12, 2018
node-sass imports with assets
View dep.scss
// scss/dep.scss
#foo {
.foo {
background: url('../images/a.jpg');
:fullscreen a {
display: flex
}
}
@digitalkaoz
digitalkaoz / index.js
Created Dec 20, 2017
gatsby in aws lambda
View index.js
const AWS = require("aws-sdk");
const {link} = require("linkfs");
const mock = require('mock-require');
const fs = require('fs');
const tmpDir = require('os').tmpdir();
exports.handler = (event, context) => {
rewriteFs();
invokeGatsby(context);
}
@digitalkaoz
digitalkaoz / files.js
Last active Oct 18, 2017
Jest + Filesystem mocks
View files.js
//your files
module.exports = {
"src/a.js": `const b = require("./b");module.exports = class A {}`,
"src/b.js": "module.exports = class B {}",
};
@digitalkaoz
digitalkaoz / docker.logs
Created Oct 25, 2016
rabbitmq haproxy logstash logs
View docker.logs
proxy_1 | [WARNING] 298/144827 (1) : Server amqp/rabbit is UP, reason: Layer4 check passed, check duration: 0ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
logstash_1 | {:timestamp=>"2016-10-25T14:48:30.597000+0000", :message=>"starting agent", :level=>:info}
logstash_1 | {:timestamp=>"2016-10-25T14:48:30.614000+0000", :message=>"starting pipeline", :id=>"main", :level=>:info}
proxy_1 | 00000000:amqp.accept(0006)=0007 from [172.18.0.5:40804]
rabbit_1 |
rabbit_1 | =INFO REPORT==== 25-Oct-2016::14:48:30 ===
rabbit_1 | accepting AMQP connection <0.587.0> (172.18.0.3:38038 -> 172.18.0.2:5672)
logstash_1 | {:timestamp=>"2016-10-25T14:48:30.881000+0000", :message=>"Connected to RabbitMQ at proxy", :level=>:info}
logstash_1 | {:timestamp=>"2016-10-25T14:48:31.064000+0000", :message=>"Starting pipeline", :id=>"main", :pipeline_workers=>2, :batch_size=>125, :batch_delay=>5, :max_inflight=>250, :level=>:info}
logstash_1 | {:timestamp=>"2016-10-25T14:48:31.080000+0
View mapping.json
{
"entity": {
"dynamic_templates": [
{
"time_string": {
"mapping": {
"format": "strict_date_time",
"index": "not_analyzed",
"type": "date"
},
@digitalkaoz
digitalkaoz / test.js
Created Feb 17, 2016
JS Array diffing with objects that respect duplicates
View test.js
var _ = require('underscore');
var a = [{type: 'green'}];
var b = [{type: 'green'},{type: 'green'}];
var onlyInA = a.filter((current) => {
return b.filter((current_b) => {
return _.isEqual(current, current_b);
}).length == 0