Skip to content

Instantly share code, notes, and snippets.

Avatar

Dawid Sibiński dsibinski

View GitHub Profile
View UnitTest_WithAssertObject.cs
[Test]
public void ApplyBlackFridayDiscount_Should_ApplyBlackFridayDiscount_When_CalledOnNewProduct()
{
// given
var product = CreateProduct(basePrice: 100);
// when
product.ApplyBlackFridayDiscount();
// then
View AssertObject_pattern.cs
class ProductAssert
{
private readonly Product _product;
public ProductAssert(Product product)
{
_product = product;
}
public ProductAssert HaveDiscount(string name, int value)
View Asserts_problem.cs
[Test]
public void ApplyBlackFridayDiscount_Should_ApplyBlackFridayDiscount_When_CalledOnNewProduct()
{
// given
var product = CreateProduct(basePrice: 100);
// when
product.ApplyBlackFridayDiscount();
// then
View string_prototype_helpers.ts
interface String {
contains(this : string, it : any): boolean;
}
String.prototype.contains = function (it) {
return this.indexOf(it) != -1;
};
View string_prototype_helpers.js
String.prototype.contains = function (it) {
return this.indexOf(it) != -1;
};
View webpack_partial.config.js
devtool: "eval-source-map",
module: {
rules: [
{
enforce: "pre",
test: /\.js$/,
exclude: /node_modules/,
loader: "source-map-loader"
},
{
View services.ts
module.exports.UsersService = function (url) {
// ... UsersService init code ...
};
module.exports.UsersService.prototype.getUser = function (id) {
// ... code to get active user by id ...
};
export class NewUsersService {
View main_stateful_widget_full.dart
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
title: "My CodeJourney Flutter app",
home: MySecondWidget(),
),
);
class MySecondWidget extends StatefulWidget {
View main_stateful_widget.dart
class MySecondWidget extends StatefulWidget {
MySecondWidget({Key key}) : super(key: key);
@override
_MySecondWidgetState createState() =>
_MySecondWidgetState();
}
class _MySecondWidgetState extends State<MySecondWidget> {
int _clickCount = 0;
View main_stateless_widget.dart
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
title: "My CodeJourney Flutter app",
home: Scaffold(
appBar: AppBar(
title: Text("My First App"),
),
body: MyFirstWidget(),