Skip to content

Instantly share code, notes, and snippets.

View bobwei's full-sized avatar

Bob Wei bobwei

View GitHub Profile
WEBVTT
1
00:00:01.000 --> 00:00:10.000
Welcome to bitmovin's bitdash!
2
00:00:11.000 --> 00:00:15.000
Experience our highly optimized MPEG-DASH clients...
const $el = $0;
const nLikes = 1000;
const delaySecs = 1;
[...new Array(100)].reduce((acc) => {
return acc.then(
() =>
new Promise((resolve) => {
$el.click();
setTimeout(resolve, delaySecs * 1000);
}),
@bobwei
bobwei / permutation.js
Created November 29, 2018 14:30
permutation.js
const createPermutation = (arr, selected = new Set(), output = []) => {
if (selected.size >= arr.length) {
output.push([...selected].map((i) => arr[i]));
return output;
}
for (let i = 0; i < arr.length; i++) {
if (selected.has(i)) {
continue;
}
selected.add(i);
@bobwei
bobwei / bind.js
Created November 23, 2018 03:41
bind.js
function test() {
return this.name;
}
// please implement your bind function here.
Function.prototype.bindFunction = function(context) {
};
const context = {
export CONTAINER_NAME=
docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" $(docker ps --filter=name=${CONTAINER_NAME} -q)
@bobwei
bobwei / .drone.yml
Created December 15, 2017 17:13 — forked from learncodeacademy/.drone.yml
Rancher Drone CD Pipeline Setup
pipeline:
slack:
image: plugins/slack
webhook: <your slack webhook url>
channel: deployments
username: drone
template: "<{{build.link}}|Deployment #{{build.number}} started> on <http://github.com/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}}:{{build.branch}}> by {{build.author}}"
when:
branch: [ master, staging ]
build:
import React from 'react';
import compose from 'recompose/compose';
import withState from 'recompose/withState';
import withHandlers from 'recompose/withHandlers';
import flattenProp from 'recompose/flattenProp';
const Comp = ({ images, isOpen, currentImage, next, previous, toggleOpen }) =>
<Lightbox
images={images}
isOpen={isOpen}
import 'dotenv/config';
import { CronJob } from 'cron';
const { JOB1_CRON_TIME } = process.env;
new CronJob({
cronTime: JOB1_CRON_TIME,
onTick: () => {
console.log('do your job');
},
curl -X POST \
-H "Content-Type: application/json" \
-d '{}' \
${BASE_API_URL}