Skip to content

Instantly share code, notes, and snippets.

View digitalkaoz's full-sized avatar

Robert Schönthal digitalkaoz

View GitHub Profile
{"schemaVersion":1,"label":"Test Coverage","message":"93.2%","color":"green"}
@digitalkaoz
digitalkaoz / model.py
Last active December 25, 2020 00:42
SQL Alchemy Many To Many Relation delete cascading
# 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):
[ +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 February 5, 2020 20:33
Flutter mobx state problem
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 March 12, 2018 21:37
node-sass imports with assets
// scss/dep.scss
#foo {
.foo {
background: url('../images/a.jpg');
:fullscreen a {
display: flex
}
}
@digitalkaoz
digitalkaoz / index.js
Created December 20, 2017 21:32
gatsby in aws lambda
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 October 18, 2017 15:23
Jest + Filesystem mocks
//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 October 25, 2016 14:55
rabbitmq haproxy logstash 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
{
"entity": {
"dynamic_templates": [
{
"time_string": {
"mapping": {
"format": "strict_date_time",
"index": "not_analyzed",
"type": "date"
},
@digitalkaoz
digitalkaoz / test.js
Created February 17, 2016 11:37
JS Array diffing with objects that respect duplicates
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