Skip to content

Instantly share code, notes, and snippets.

View maolion's full-sized avatar
👋
门前大桥下 游过一群鸭 大家快来数一数 🐣🐤🐥 🦆 🎱

江宜玮 maolion

👋
门前大桥下 游过一群鸭 大家快来数一数 🐣🐤🐥 🦆 🎱
View GitHub Profile
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@philadams-zz
philadams-zz / webgl-detect.js
Created January 31, 2012 07:47
WebGL Javascript Detection
// JQuery only used for selecting and removing elements,
// mostly left in for the below ALERT.
// the console.log statements are for your sanity checks.
var asa; var canvas; var dcanvas; var gl; var expmt;
canvas = $('#my-canvas');
console.log(canvas);
// check to see if we can do webgl
// see http://jsbin.com/okoxiq/3/edit
var src
, fftSize = 1024
, audio = new Audio()
, ac = new webkitAudioContext()
, analyser = ac.createAnalyser()
, timeData = new Uint8Array(fftSize)
, bar = document.querySelector('.bar')
, url = 'http://static1.kevincennis.com/sounds/callmemaybe.mp3';
@BiosSun
BiosSun / contain.js
Last active September 25, 2019 02:26
矩形缩放算法,JS 版。http://jsfiddle.net/TJjJd/1/
/**
* 将原尺寸缩放使之能够填充目标尺寸,缩放后尺寸小于或等于目标尺寸,
* 且有一边与原尺寸相同。
* @param w1 目标尺寸 - 宽度
* @param h1 目标尺寸 - 高度
* @param w2 原尺寸 - 宽度
* @param h2 原尺寸 - 高度
*/
function contain(w1, h1, w2, h2) {
@subchen
subchen / git-stash.md
Created October 31, 2014 08:56
Git Stash 用法

git stash用于保存和恢复工作进度

  • git stash

    保存当前的工作进度。会分别对暂存区和工作区的状态进行保存

  • git stash save "message..."

这条命令实际上是第一条 git stash 命令的完整版

@bparadie
bparadie / react-native.d.ts
Last active January 5, 2017 09:11
Incomplete react-native.d.ts, requires react.d.ts from DefinitelyTyped
declare module "react-native" {
import * as React from 'react';
import {ComponentClass, ReactType, ReactNode, ReactElement} from 'react';
export * from 'react';
/**
* Represents the completion of an asynchronous operation
* @see lib.es6.d.ts
@rkuzsma
rkuzsma / gist:b9a0e342c56479f5e58d654b1341f01e
Last active May 18, 2024 15:40
Example Kubernetes yaml to pull a private DockerHub image
Step by step how to pull a private DockerHub hosted image in a Kubernetes YML.
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
kubectl create secret docker-registry myregistrykey \
--docker-server=$DOCKER_REGISTRY_SERVER \
--docker-username=$DOCKER_USER \
@xiaoliang2233
xiaoliang2233 / Timer.js
Last active July 7, 2021 10:53
debounceTime, auditTime, throttleTime
/**
* auditTime 是每次点击开始计时, 超时的时候再emit最近的一次事件
*
* throttleTime 是每次点击emit事件, 之后的一段时间不会再触发事件
*
* debounceTime 是每次点击重新计时, 超时的时候emit此事件
*/
let print = auditTime(1000, e => {
console.log('😋', e)