This file contains 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
var $window = $(window), | |
lastScrollTop = 0; | |
function onScroll (e) { | |
var top = $window.scrollTop(); | |
if (lastScrollTop > top) { | |
console.log('top'); | |
} else if (lastScrollTop < top) { | |
console.log('down'); | |
} |
This file contains 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
export type SwipeDirect = ('none' | 'left' | 'right' | 'up' | 'down') | |
export interface ISwipeDetect { | |
direct: SwipeDirect | |
offsetDist: number | |
startX: number | |
startY: number | |
distX: number | |
distY: number | |
init: () => void |
This file contains 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
{ | |
"jsx-component": { | |
"prefix": "jsx-component", | |
"body": [ | |
"import React, { Component } from 'react'", | |
"import PropTypes from 'prop-types'", | |
"", | |
"import c from './${2:style}.style.sass'", | |
"", | |
"export default class ${1:component} extends Component {", |
This file contains 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
{ | |
"tsx-test-filename": { | |
"prefix": "tsx-test-filename", | |
"body": [ | |
"${TM_FILENAME_BASE/^(.)|([.-](.))/${1:/upcase}${3:/upcase}/g}", | |
], | |
"description": "TSX filename" | |
}, | |
"tsx": { |
This file contains 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
export const deepCopy = (data) => { | |
return typeof data === 'object' ? ( | |
JSON.parse(JSON.stringify(data)) | |
) : ( | |
data | |
) | |
} | |
export function Store(_init) { | |
let init = deepCopy(_init) |
This file contains 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
var api = new GraphQL(path, { | |
method: 'POST', // POST by default. | |
headers: { | |
'Access-Token': 'some-access-token' | |
}, | |
query: { | |
tags: 'tags { ...tag }', | |
tag: 'tag { ...tag }', | |
}, | |
mutation: { |
This file contains 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
const pathToRoute = (path = '') => { | |
return path.split('.').map(key => `['${key}']`).join('') | |
} | |
const onGet = (path = '') => { | |
return new Function('obj', `return obj${pathToRoute(path)}`) | |
} | |
const onSet = (path = '') => { | |
return new Function('obj', 'val', `obj${pathToRoute(path)} = val; return obj`) |
This file contains 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 { GraphQLResolveInfo } from 'graphql' | |
const unique = (arr = []) => { | |
let obj = {} | |
for (let i = 0;i < arr.length;i++) { | |
let str = arr[i] | |
if (!!str) obj[str] = true | |
} | |
return Object.keys(obj) | |
} |
This file contains 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 * as d3 from 'd3' | |
import c from '../styles.css' | |
const svg = d3.select('svg') | |
const margin = { top: 20, right: 20, bottom: 110, left: 40 } | |
const width = +svg.attr('width') - margin.left - margin.right | |
const height = +svg.attr('height') - margin.top - margin.bottom | |
const margin2 = { top: 430, right: 20, bottom: 30, left: 40 } | |
const height2 = +svg.attr('height') - margin2.top - margin2.bottom |
This file contains 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
const http = require('http'); | |
const httpProxy = require('http-proxy'); | |
const options = { | |
changeOrigin: true, | |
protocol: 'https', | |
target: 'https://yobit.net', | |
host: 'yobit.net', | |
}; |
OlderNewer