Skip to content

Instantly share code, notes, and snippets.

View shaomingquan's full-sized avatar

__qms shaomingquan

View GitHub Profile
@shospodarets
shospodarets / Chrome headless Puppeteer- capture DOM element screenshot using
Last active January 17, 2023 18:52
Chrome headless Puppeteer- capture DOM element screenshot using
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
@rchanou
rchanou / SemiControlledInput.js
Last active January 4, 2021 02:35
Semi-Controlled Input
export default class Input extends React.Component {
static defaultProps = {
onChange() {},
onFocus() {},
onBlur() {}
};
constructor(props) {
super();
this.state = {
@ac-astuartkregor
ac-astuartkregor / redis
Last active July 26, 2019 05:23
A generic Centos init script for redis
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis/redis.pid
@stoewer
stoewer / ToSnakeCase.go
Last active March 29, 2022 16:59
Convert camel case to snake case in Go http://play.golang.org/p/9ybqJat1Hr
import (
"fmt"
"strings"
"regexp"
)
var matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)")
var matchAllCap = regexp.MustCompile("([a-z0-9])([A-Z])")
@soundyogi
soundyogi / 2018_chrome_snippet_gui_import_export.js
Last active December 24, 2023 22:09
A snippet to export and import your chrome snippets
void function() { "use strict"
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WIP DO NOT USE WIP !!!!!!!!!!!!!!!!!!!!!
DO NOT USE THIS YET.
USE THE 2016 VERSION BELOW PLEASE.
WWWWWWWW WWWWWWWWIIIIIIIIIIPPPPPPPPPPPPPPPPP
W::::::W W::::::WI::::::::IP::::::::::::::::P
W::::::W W::::::WI::::::::IP::::::PPPPPP:::::P
@tevino
tevino / epoll.go
Last active January 20, 2024 22:50
An example of using epoll in Go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 00:55
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites