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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 log(a,b){ | |
return Math.log(b)/Math.log(a); | |
} | |
function convert(_input, source, target) { | |
var input = _input.toString(); | |
var I_L = source.length,T_L = target.length; | |
var len = input.length; | |
var num = input.split('').reduce((res,letter,i)=>{ | |
var index = source.indexOf(letter); |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "C++ Launch (OSX)", | |
"type": "lldb", | |
"request": "launch", | |
"program": "${workspaceRoot}/Debug/out.o", | |
"MIMode": "lldb", | |
"stopAtEntry": false, |
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 check(){ | |
setTimeout(()=>( | |
var len = 0, arr = [],count = 0; | |
arr = Array.prototype.slice.call(document.head.children).filter(el=>((el.tagName == 'LINK'&& el.href) || (el.tagName == 'SCRIPT' && el.src))),len = arr.length,arr).forEach(e=> | |
e.addEventListener('load',()=>console.log(`finished ${++count} of ${len}`))),0); | |
} | |
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
/// <reference types="react" /> | |
import React from 'react'; | |
import { AbstractInputProps } from './Input'; | |
export interface AutoSizeType { | |
minRows?: number; | |
maxRows?: number; | |
} | |
export interface TextAreaProps extends AbstractInputProps { | |
autosize?: boolean | AutoSizeType; | |
onPressEnter?: React.FormEventHandler<any>; |
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 Axios from 'axios'; | |
import { | |
isArray | |
} from 'lodash'; | |
import qs from 'qs'; | |
const CGI_SERVER = process.env.CGI_SERVER; | |
export const cgiServerPath = () => CGI_SERVER; | |
const postConfig = { | |
method: 'POST', |
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
export function resetVH(){ | |
const vh100 = window.innerHeight; | |
const styleContent = ` | |
.vh-100 { | |
height: ${vh100}px; | |
} | |
`; | |
const node = document.createElement('style'); | |
node.type = 'text/css'; | |
node.innerHTML = styleContent; |
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
/* | |
when querying attributes using alias like: | |
attributes: [['m','n']] // to show m as n | |
sequelize will wrap the field word width '`' | |
the query will looks like `m` AS `n` | |
this seems simple; | |
but when query JSON fields: | |
//my data column: data, value: {name:'wungcq'} | |
attributes: ["data->'$.name'","name"] |
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
<script> | |
(function(){ | |
function getQuery(r){var n=r||window.location.search;try{return(n?n.slice(1).split("&"):[]).reduce(function(r,n){var t=n.split("=");return r[t[0]||""]=t[1]||"",r},{})}catch(r){return{}}} | |
function stringifyQuery(r){var n=[];for(var t in r)n.push(t+"="+r[t]);return"?"+n.join("&")} | |
!function(){var o=getQuery(),n=Math.floor(Date.now()/12e4);if(o.tpv!=n){o.tpv=n;var i=window.location.origin+window.location.pathname+stringifyQuery(o)+window.location.hash;window.location.href=i}}(); | |
})(); | |
</script> |
OlderNewer