Skip to content

Instantly share code, notes, and snippets.

View dennis-8's full-sized avatar

Dennis N. dennis-8

View GitHub Profile
@dennis-8
dennis-8 / redux-actions.ts
Created June 6, 2019 14:55 — forked from milankorsos/redux-actions.ts
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
@dennis-8
dennis-8 / enzyme-cheatsheet.js
Created April 20, 2019 07:49 — forked from jahe/enzyme-cheatsheet.js
Enzyme Cheatsheet
// Show rendered HTML
const wrapper = shallow(<App />)
console.log(wrapper.debug())
// Disable lifecycle methods of react within tests
const wrapper = mount(<App />, { disableLifecycleMethods: true })
// Assert number of occurrences
expect(wrapper.find('p').length).toBe(1)
https://github.com/eligrey/FileSaver.js/
https://stackoverflow.com/a/49190517/217372
Link: https://sindresorhus.com/multi-download/browser.js
@dennis-8
dennis-8 / gist:ffe0d50160bfbfe94b15ad3e1ea7a8bd
Created August 14, 2018 10:42
AngularJS component - check if method callback is present
https://stackoverflow.com/a/38914917
@dennis-8
dennis-8 / gist:b3f70969e64a2fb2a70ca674ef93f3eb
Created August 13, 2018 12:31
How to add ng-model functionality to AngularJS component
Link: https://stackoverflow.com/questions/44594532/how-to-add-ng-model-functionality-to-a-component/44595910#44595910
# config is located here: /etc/nginx/sites-available
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
@dennis-8
dennis-8 / gist:23ca5d036ae7e305a1c1467bc717b62f
Created July 26, 2018 21:58
Change ExecJS runtime in RoR
How to change ExecJS runtime in RoR
@dennis-8
dennis-8 / gist:d673f6e6e37a97a669cb7aaf604c5d94
Created July 14, 2018 13:31
Hide or show DOM element depending on UI-Router state
You can use isState filter with either ng-show or ng-hide.