Skip to content

Instantly share code, notes, and snippets.

// 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)
Array.from(document.querySelectorAll('.result'))
.map(e => e.querySelector('.to').textContent.split(" ")[1]).join("\n")
// then put it here
// https://www.mapcustomizer.com/#
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);
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],
Array.from(document.querySelectorAll('.result'))
.filter(e => e.querySelector('.totalPrice').textContent.split(' ')[0] > 100)
.forEach(e => e.remove())
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;
s.match(/get(.*)\(/g).map(_.pipe(
_.replace('get',''),
_.replace('(', ''),
_.over(_.lensIndex(0), _.toLower),
_.join(''),
)).join("\n")
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);
});
@szmeku
szmeku / untar.sh
Created November 26, 2017 18:40
Untar tar in parts
cat data.ext4.tar data.ext4.tar.a | tar xf -
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);
});