Skip to content

Instantly share code, notes, and snippets.

View apieceofbart's full-sized avatar

Bartek apieceofbart

View GitHub Profile
@apieceofbart
apieceofbart / .eslintrc
Created March 7, 2017 07:04
Example of .eslintrc file
{
"extends": [ "eslint:recommended" ],
"env": {
"node": true,
"browser": true,
}
}
@apieceofbart
apieceofbart / -README.md
Created April 22, 2017 10:19 — forked from jirutka/-README.md
How to use terminal on Windows and don’t go crazy…

How to use terminal on Windows without going crazy…

Windows is really horrible system for developers and especially for devops. It doesn’t even have a usable terminal and shell, so working with command line is really pain in the ass. If you really don’t want to switch to any usable system (OS X, Linux, BSD…), then this guide should help you to setup somewhat reasonable environment – usable terminal, proper shell, ssh client, git and Sublime Text as a default editor for shell.

Install stuff

  1. Download and install Git for Windows* with:
    • [✘] Use Git from the Windows Command Prompt
  • [✘] Checkout as-is, commit Unix-style line endings
@apieceofbart
apieceofbart / keys-mapping.ahk
Created May 3, 2017 07:31
AutoHotkey mappings
^Left::Send {Home}
^Right::Send {End}
^+Left:: Send {Shiftdown}{Home}
^+Right::Send {Shiftdown}{End}
@apieceofbart
apieceofbart / typescript-react-quickstart.md
Created June 10, 2017 15:15 — forked from benedyktdryl/typescript-react-quickstart.md
Quick notes for people starting with React & Typescript
@apieceofbart
apieceofbart / es7-async-await.js
Created June 23, 2017 09:28 — forked from msmfsd/es7-async-await.js
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@apieceofbart
apieceofbart / Button.tsx
Created October 10, 2017 10:37
Styled components with Typscript
import * as React from "react";
interface IProps {
children?: React.ReactChild;
className?: string;
}
class Button extends React.Component<IProps, {}> {
public render() {
return (
@apieceofbart
apieceofbart / async-component.spec.js
Created December 15, 2017 12:32 — forked from mrparkers/async-component.spec.js
Unit testing an async React component using Mocha, Chai, and Enzyme
import AsyncComponent from './path/to/component';
import request from 'your-request-library';
import React from 'react';
import {shallow} from 'enzyme';
import Chance from 'chance';
import chai, {expect} from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
@apieceofbart
apieceofbart / test.js
Created February 21, 2018 13:15
mock lodash debounce in jest
// somewhere on top
import _ from 'lodash';
jest.unmock('lodash');
// then
_.debounce = jest.fn((fn) => fn);
@apieceofbart
apieceofbart / remove-node-modules.md
Last active September 6, 2024 18:21 — forked from lmcneel/remove-node-modules.md
How to remove node_modules after they have been added to a repo

How to remove node_modules

  1. Create a .gitignore file in the git repository if it does not contain one

  2. Open up the .gitignore and add the following line to the file

node_modules

  1. Remove the node_modules folder from the git repository
@apieceofbart
apieceofbart / example.action-types.ts
Created September 9, 2019 14:04 — forked from Vovan-VE/example.action-types.ts
TypeScript: redux-thunk & redux-promise-middleware together
import { AsyncAction, AsyncFulfilledAction } from '.../redux-thunk-promise';
export const FETCH = '.../FETCH';
export const FETCH_PENDING = '.../FETCH_PENDING';
export const FETCH_FULFILLED = '.../FETCH_FULFILLED';
export const FETCH_REJECTED = '.../FETCH_REJECTED';
export interface FetchAction extends AsyncAction<ApiResult> {
type: typeof FETCH;
}