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
// from [{barcode: 'aaa', valid: true, ....}, {barcode: 'bbb', valid: false, ....}] | |
// to {'aaa': {valid: true}, 'bbb': {valid:false}} | |
_.pipe( | |
_.map(_.pipe( | |
_.juxt([ | |
_.prop('barcode'), | |
_.dissoc('barcode') | |
]), | |
_.apply(_.objOf) |
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
Array.from(document.querySelectorAll('.result')) | |
.map(e => e.querySelector('.to').textContent.split(" ")[1]).join("\n") | |
// then put it here | |
// https://www.mapcustomizer.com/# |
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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import * as _ from 'ramda'; | |
class Game extends React.Component { | |
constructor(props) { | |
super(props); |
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
function calculateWinner(squares) { | |
const lines = [ | |
[0, 1, 2], | |
[3, 4, 5], | |
[6, 7, 8], | |
[0, 3, 6], | |
[1, 4, 7], | |
[2, 5, 8], | |
[0, 4, 8], | |
[2, 4, 6], |
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
Array.from(document.querySelectorAll('.result')) | |
.filter(e => e.querySelector('.totalPrice').textContent.split(' ')[0] > 100) | |
.forEach(e => e.remove()) |
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
function excelDateToJSDate(serial) { | |
var utc_days = Math.floor(serial - 25569); | |
var utc_value = utc_days * 86400; | |
var date_info = new Date(utc_value * 1000); | |
var fractional_day = serial - Math.floor(serial) + 0.0000001; | |
var total_seconds = Math.floor(86400 * fractional_day); | |
var seconds = total_seconds % 60; |
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
s.match(/get(.*)\(/g).map(_.pipe( | |
_.replace('get',''), | |
_.replace('(', ''), | |
_.over(_.lensIndex(0), _.toLower), | |
_.join(''), | |
)).join("\n") |
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 promisifyFunction = function (func) { | |
return function () { | |
let that = this, | |
// IE10 fix (in IE10 Promise.all(arguments) neither Array.from(arguments) doesn't work | |
args = Array.from ? Array.from(arguments) : _.map(_.identity, arguments); | |
return Promise.all(args).then(function (resolvedArguments) { | |
return func.apply(that, resolvedArguments); | |
}); |
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
cat data.ext4.tar data.ext4.tar.a | tar xf - |
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
window.futureQuerySelectorAll = selector => new Promise(resolve => { | |
let checkExist = setInterval(function() { | |
if (document.querySelectorAll(selector).length > 0) { | |
resolve(Array.from(document.querySelectorAll(selector))); | |
clearInterval(checkExist); | |
} | |
}, 100); | |
}); |