Skip to content

Instantly share code, notes, and snippets.

@jerseysu
jerseysu / diff2html.sh
Created March 17, 2020 05:07 — forked from stopyoukid/diff2html.sh
Script that takes a git diff and outputs an html file in GitHub style
#!/bin/bash
#
# Convert diff output to colorized HTML.
# (C) Mitch Frazier, 2008-08-27
# http://www.linuxjournal.com/content/convert-diff-output-colorized-html
# Modified by stopyoukid
#
html="<html><head><meta charset=\"utf-8\"><title>Pretty Diff</title><style>body {text-align: center;}#wrapper {display: inline-block;margin-top: 1em;min-width: 800px;text-align: left;}h2 {background: #fafafa;background: -moz-linear-gradient(#fafafa, #eaeaea);background: -webkit-linear-gradient(#fafafa, #eaeaea);-ms-filter: \"progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa',endColorstr='#eaeaea')\";border: 1px solid #d8d8d8;border-bottom: 0;color: #555;font: 14px sans-serif;overflow: hidden;padding: 10px 6px;text-shadow: 0 1px 0 white;margin: 0;}.file-diff {border: 1px solid #d8d8d8;margin-bottom: 1em;overflow: auto;padding: 0.5em 0;}.file-diff > div {width: 100%:}pre {margin: 0;font-family: \"Bitstream Vera Sans Mono\", Courier, monospace;font-size: 12px;line-height: 1.4em;text-indent: 0.5em;}.file {color:
@jerseysu
jerseysu / app_test.dart
Created September 21, 2019 07:14
app_test.dart
import 'dart:async';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
import 'package:glob/glob.dart';
import 'hooks/hook_example.dart';
import 'steps/step_definition.dart';
Future<void> main() {
final config = FlutterTestConfiguration()
..features = [Glob(r"test_driver/features/**.feature")]
@jerseysu
jerseysu / step_definition.dart
Created September 20, 2019 08:52
step_definition file
import '../pages/landing_page.dart';
class TapButtonNTimesStep extends When2WithWorld<String, int, FlutterWorld> {
TapButtonNTimesStep()
: super(StepDefinitionConfiguration()..timeout = Duration(seconds: 30));
@override
Future<void> executeStep(String key, int times) async {
final landingPage = new LandingPage(world.driver);
await landingPage.tapPlusOneBtnForNTimes(key, times, world);
@jerseysu
jerseysu / hello_world.feature
Created September 20, 2019 07:17
Hello World Feature file
Feature: Hello World
Hello World feature test
Scenario: Check App Title And Content
Given I expect the "firstTabTitle" to be "Jeresy Cool!"
Then I expect the "textField" to be "Hello, Jersey!"
Scenario: Check App Title When Switch Page
Given I go to second page
Then I expect second page title to be "Jersey Second Tab"
@jerseysu
jerseysu / Step Definition
Last active May 16, 2018 19:04
Step Definition
self.application = application
//A Given step definition
Given("the app is running") { (args, userInfo) -> Void in
application.launch()
}
//Another step definition
MatchAll("I select \"([^\\\"]*)\"") { (args, userInfo) -> Void in
let mealName = args?[0]
@jerseysu
jerseysu / Food.feature
Created May 16, 2018 18:34
FoodFeature
Feature: FoodTracker Cucumberish Exapmle
Scenario: Verify Meal Caption
Given the app is running
When I select "Caprese Salad"
Then I should see Caprese Salad
Scenario Outline: Verify Meal Rating
When I select "<meal>"
And I rating as <star>
@jerseysu
jerseysu / CucumberishSwiftInit
Last active May 16, 2018 18:51
cucumberish class
import Cucumberish
@objc class CucumberishInitializer: NSObject {
@objc class func CucumberishSwiftInit()
{
//Using XCUIApplication only available in XCUI test targets not the normal Unit test targets.
var application : XCUIApplication!
//A closure that will be executed only before executing any of your features
beforeStart { () -> Void in
//Any global initialization can go here