start new:
tmux
start new with session name:
tmux new -s myname
/** | |
* This method auto add to a list of actions the suffixes | |
* provided by `redux-promise-middleware`. | |
* | |
* Example: | |
* | |
* export default createActionTypes(['GET_USER', 'CREATE_USER']) | |
* | |
* [object Object] { | |
* CREATE_USER: "CREATE_USER", |
First download the new old icon: https://cl.ly/mzTc (based on this)
You can also use the icon you want, but you need to convert it to .icns
. You can use this service to convert PNG to ICNS.
Go to Applications
and find VSCode
, right click there and choose Get Info
. Drag 'n drop the new icon.
import { map, assign, mapKeys } from 'lodash' | |
const state = [ | |
{ id: 1, coords: [4, 5, 6] }, | |
{ id: 2, coords: [4, 5, 6] }, | |
{ id: 6, coords: [4, 5, 6] }, | |
{ id: 7, coords: [4, 5, 6] }, | |
{ id: 8, coords: [4, 5, 6] } | |
] |
import React, { Component } from 'react' | |
import { FlatList, Text } from 'react-native' | |
class ItemListView extends Component { | |
state = { | |
currentPage: 1, | |
perPage: 3, | |
items: [ | |
{ name: 'A', id: 1 }, { name: 'B', id: 2 }, { name: 'C', id: 3 }, | |
{ name: 'D', id: 4 }, { name: 'E', id: 5 }, { name: 'F', id: 6 }, |
// original gist | |
const shuffleArray = arr => arr.sort(() => Math.random() - 0.5); | |
// fully random by @BetonMAN | |
const shuffleArray = arr => arr | |
.map(a => [Math.random(), a]) | |
.sort((a, b) => a[0] - b[0]) | |
.map(a => a[1]); | |
shuffleArray([1, 2, 3]) //[3, 1, 2] |
const fetchMock = (response) => { | |
window.fetch = jest.fn().mockImplementation(() => | |
new Promise((resolve) => { | |
resolve({ json: () => response }) | |
}) | |
) | |
} | |
const fetchMockRejected = (response) => { | |
window.fetch = jest.fn().mockImplementation(() => |
var votes = [ | |
'angular', | |
'angular', | |
'react', | |
'react', | |
'react', | |
'angular', | |
'ember', | |
'react', | |
'vanilla' |
const debounce = function(fn, delay = 450) { | |
let timeout = null; | |
return () => { | |
timeout && clearTimeout(timeout); | |
timeout = setTimeout(fn.bind(this), delay, arguments); | |
}; | |
}; | |
// debounce(fn, 300) |
const Application = ((d) => { | |
const privateVariable = 'Private content' | |
const __private = { | |
cache: () => { | |
this.link = d.querySelector('.link') | |
}, | |
bind: () => { | |
this.link.addEventListener('click', this.showContent, false) |