This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
concat, | |
head, | |
last, | |
map, | |
pipe, | |
split | |
} from 'ramda'; | |
let getNames = split(' '); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { always, map, propEq, when } from 'ramda' | |
let replaceItem = (item, list) => | |
map(when( propEq('id', item.id) , always(item)), list) | |
export default replaceItem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// takes the window | |
// returns params as an object | |
export const getQueryParams = pipe( | |
path(['location', 'search']), | |
tail, | |
split('&'), | |
map(split('=')), | |
fromPairs, | |
map(decodeURI) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Sandbox</title> | |
<script src="https://unpkg.com/react@16/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | |
<script src="https://unpkg.com/[email protected]/babel.min.js"></script> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let util = require('util') | |
export default function inspect(x, depth) { | |
console.log(util.inspect(x, {showHidden: true, depth: depth || null})) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.source.js': | |
'React Component': | |
'prefix': 'rc' | |
'body': """ | |
import React, { Component } from 'react' | |
export default class ${1:Classname} extends Component { | |
constructor(props) { | |
super(props) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let data = { | |
one: {links: ['one', 'two','three'], stuff: {one: 1, two: 2, three: 3} }, | |
two: {links: ['four', 'five','six'], stuff: {four: 4, five: 5, six: 6} }, | |
three: {links: ['seven', 'eight','nine'], stuff: {seven: 7, eight: 8, nine: 9} } | |
} | |
class App extends Component { | |
constructor(props) { | |
super(props) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fetcher(url) { | |
return fetch(url).then(res => res.json()) | |
} | |
async function get(url) { | |
var result = await fetcher(url); | |
return result | |
} | |
get('https://jsonplaceholder.typicode.com/users') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/creationix/nvm | |
nvm install node --reinstall-packages-from=node | |
nvm ls | |
nvm alias default ${newVersion} | |
nvm uninstall ${oldVersion} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { m, sm, mountWithPlugin } from './utils.js' | |
// reduce mounting boilerplate | |
import Component from '@/views/Comp.vue' | |
const wrapper = m(Component) |