Skip to content

Instantly share code, notes, and snippets.

View ricca509's full-sized avatar

Riccardo Coppola ricca509

View GitHub Profile
@ricca509
ricca509 / docker-compose.yml
Last active September 1, 2016 09:09
WebdriverIO example docker-compose
app:
build: .
command: npm test -- --host selenium
links:
- selenium
selenium:
image: selenium/standalone-chrome
expose:
- "4444"
@ricca509
ricca509 / index.spec.js
Created August 31, 2016 21:17
WebdriverIO test example
var assert = require('assert');
describe('webdriver.io page', function() {
it('should have the right title', function () {
browser.url('http://webdriver.io');
var title = browser.getTitle();
assert.equal(title, 'WebdriverIO - Selenium 2.0 javascript bindings for nodejs');
});
});
@ricca509
ricca509 / GitHub-Forking.md
Created September 26, 2016 09:43 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, when I started going through the process of forking and issuing pull requests, I had some trouble figuring out the proper method for doing so and made quite a few mistakes along the way. I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your

const path = require('path');
const merge = require('webpack-merge');
const devConfig = require('./webpack.dev.config');
const prodConfig = require('./webpack.prod.config');
var config;
const common = {
entry: {
@ricca509
ricca509 / snapshot-function.js
Created February 20, 2017 22:53
snapshot-function
export function parseDate (date) {
return {
day: date.getDate(),
month: date.getMonth() + 1,
year: date.getFullYear()
};
}
@ricca509
ricca509 / snapshot-function-test.js
Created February 20, 2017 22:54
snapshot-function-test
import { parseDate } from '..';
describe('parseDate', () => {
it('parses a Date object', () => {
const expectedResult = {
day: 13,
month: 2,
year: 2017
};
const result = parseDate(2017, 1, 13);
@ricca509
ricca509 / snapshot-api-handler.js
Created February 20, 2017 22:55
snapshot-api-handler
import handler from '../handler';
import expectedUserJson from '../mocks/user';
describe('the user handler', () => {
it('returns the user information given its id', () => {
const response = handler('35409DJFJ48');
expect(response).toEqual(expectedUserJson);
});
});
@ricca509
ricca509 / snapshot-component-test-1.jsx
Created February 20, 2017 22:56
snapshot-component-test-1
// BuyNow.jsx
const BuyNow = ({ price, text }) => (<div>
<span className="price">£{price}</span>
<button className="btn-primary">{text}</button>
</div>);
// BuyNow.test.jsx
import { shallow } from 'enzyme';
import BuyNow from '../BuyNow';
@ricca509
ricca509 / snapshot-component-test-2.jsx
Created February 20, 2017 22:57
snapshot-component-test-2
// BuyNow.test.jsx
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import BuyNow from '../BuyNow';
describe('The BuyNow component', () => {
it('renders the right price and button', () => {
const props = { price: 25, text: 'Buy now' };
const tree = shallow(<BuyNow {...props} />);
@ricca509
ricca509 / snapshot-result-snapshot.snap
Created February 21, 2017 09:54
snapshot-result-snapshot
exports[`The BuyNow component renders the right price and button 1`] = `
<div>
<span
className="price">
£
25
</span>
<button
className="btn-primary">
Buy now