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 alias from '@rollup/plugin-alias' | |
import analyze from 'rollup-plugin-analyzer' | |
import requireContext from 'rollup-plugin-require-context' | |
import sass from 'rollup-plugin-sass' | |
import typescript from 'rollup-plugin-typescript2' | |
import VuePlugin from 'rollup-plugin-vue' | |
import fs from 'fs' | |
import path from 'path' |
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
const getMethods = (obj) => { | |
let properties = new Set() | |
let currentObj = obj | |
do { | |
Object.getOwnPropertyNames(currentObj).map(item => properties.add(item)) | |
} while ((currentObj = Object.getPrototypeOf(currentObj))) | |
return [...properties.keys()].filter(item => typeof obj[item] === 'function') | |
} |
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
package my.awesome.namespace; | |
import org.joda.time.DateTime; | |
import org.joda.time.DateTimeUtils; | |
public class TimeCop { | |
public static void freezeDuring(Runnable block) { | |
DateTimeUtils.setCurrentMillisFixed(DateTime.now().getMillis()); | |
block.run(); |
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
groupBy(array, property) { | |
return array.reduce(function(rv, x) { | |
(rv[x[property]] = rv[x[property]] || []).push(x) | |
return rv | |
}, {}) | |
} |
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
# python | |
import subprocess | |
import re | |
o = open("some_html_file.out.html","w") | |
data = open("./some_html_file.html").read() | |
def gen_id(match): | |
match = match.group() | |
id = subprocess.getoutput("cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 4") |