Skip to content

Instantly share code, notes, and snippets.

View Kotauror's full-sized avatar
🌞

Justyna Jurkowska (Zygmunt) Kotauror

🌞
  • London (UK) / Kraków (PL)
  • 11:47 (UTC +02:00)
View GitHub Profile
@Kotauror
Kotauror / stop.sh
Created October 24, 2018 14:52
stop.sh
sudo kill $(ps -ef | grep [p]ython | awk '{print $2}')
@Kotauror
Kotauror / appspec.yml
Last active October 29, 2018 15:33
appspec.yml
version: 0.0
os: linux
files:
- source: /
destination: /var/www/html/
overwrite: yes
hooks:
BeforeInstall:
- location: scripts/install_dependencies
timeout: 100
@Kotauror
Kotauror / app.py
Created October 24, 2018 13:57
pythonapp
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
@Kotauror
Kotauror / appspec.yml
Last active October 30, 2018 10:48
appspec.yml
version: 0.0
os: linux
files:
- source: /
destination: /var/www/html/
hooks:
BeforeInstall:
- location: scripts/install_dependencies
timeout: 300
runas: root
@Kotauror
Kotauror / add_contacts.js
Created October 19, 2018 08:42
add_contacts.js
describe('adding new contacts to the website', () => {
const appParent = mount(<App />)
beforeEach(() => {
appParent.find('.input-name').hostNodes().simulate('change', { target: { value: "Kosinka"}});
appParent.find('.input-phone').hostNodes().simulate('change', { target: { value: "5555"}});
appParent.find('.btn-add').hostNodes().simulate('click');
});
it('has contacts on the website after adding', () => {
@Kotauror
Kotauror / test_list.js
Created October 19, 2018 08:40
test_list.js
describe('displaying contacts on the website using data from mock fetch', () => {
it('has contacts on the website from fetch', () => {
expect(app.find('.contacts-list').children().length).toEqual(2);
})
})
@Kotauror
Kotauror / first_test_mount.js
Last active October 19, 2018 10:53
first_test_mount.js
jest.mock("../../Api")
describe('App', () => {
const app = shallow(<App />);
it('renders correctly', () => {
expect(app).toMatchSnapshot();
});
it('initializes the states with contacts fetched with Api.getContacts()', () => {
@Kotauror
Kotauror / app_mount.js
Created October 19, 2018 08:38
app_mount
class App extends React.Component {
constructor() {
super();
this.state = {
contacts: []
}
}
componentDidMount() {
@Kotauror
Kotauror / api_mock.js
Created October 19, 2018 08:24
api_mock
import axios from 'axios';
class Api {
static getContacts() {
return new Promise(function(resolve, reject) {
resolve([{
name: "Justyna",
telephone: "111111",
id: 1
@Kotauror
Kotauror / api.js
Created October 19, 2018 08:09
Api_call_react_axtios
import axios from 'axios';
class Api {
static getContacts() {
return axios.get('/contacts')
.then((response) => {
return response.data })
}