Skip to content

Instantly share code, notes, and snippets.

💭
I want play a game

Bingo Yang blackbing

💭
I want play a game
Block or report user

Report or block blackbing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@blackbing
blackbing / sticker.js
Created May 25, 2018
get link sticker from line store
View sticker.js
// > node index.js 'https://store.line.me/stickershop/product/11383/zh-Hant'
const puppeteer = require('puppeteer') ;
const fs = require('fs');
const http = require('https');
const process = require('process');
var url = process.argv[2];
(async () => {
const timeout = 30000;
@blackbing
blackbing / Checkbox.jsx
Created Feb 15, 2017
react checkbox support indeterminate
View Checkbox.jsx
import React, { PropTypes, Component } from 'react';
class Checkbox extends Component {
static propTypes = {
indeterminate: PropTypes.bool,
};
componentDidUpdate() {
if (typeof this.props.indeterminate !== 'undefined') {
this.checkbox.indeterminate = this.props.indeterminate;
@blackbing
blackbing / findObjectFromArray.js
Last active Dec 10, 2016
findObjectFromArray quickly
View findObjectFromArray.js
// @param list: array
// @param matcher: function to check match
// @param reverse: find from last if true
// Example:
// const matchedMessage = findObjectFromArray(state.list, (val) => {
// return (val.rootId === key);
// }, true);
// const matchedIndex = matchedMessage[0];
// const matchedObject = matchedMessage[1];
export default function (list, matcher, reverse = false) {
@blackbing
blackbing / .gitconfig
Last active Sep 25, 2018
my home config
View .gitconfig
[user]
name = bingo
email = blackbing@gmail.com
[core]
diff = auto
status = auto
branch = auto
log = auto
excludesfile = /Users/bingo/.gitignore_global
editor = nvim
@blackbing
blackbing / javascript.snippets
Last active Oct 31, 2016
UltiSnips for React
View javascript.snippets
snippet import "Import"
import $1 from ${VISUAL};
endsnippet
snippet import_react "Import React"
import React${1:, { PropTypes, ${2:PureComponent} }} from 'react';
endsnippet
snippet react_component "React PureComponent"
import React, { PropTypes, PureComponent } from 'react';
@blackbing
blackbing / index.html
Last active Sep 22, 2016
firebase fetch latest and older data by limit number example
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Firebase get limited latest and previous data </title>
<script src="https://www.gstatic.com/firebasejs/3.4.0/firebase.js"></script>
</head>
<body>
<div>
@blackbing
blackbing / data-taipei
Created Dec 4, 2015
nginx proxy data-taipei
View data-taipei
server {
server_name data-taipei.blackbing.net;
listen 80;
location / {
add_header 'Access-Control-Allow-Origin' *;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With';
@blackbing
blackbing / Ubounds.contains.js
Created Mar 18, 2015
Calculate a point contains in a bound
View Ubounds.contains.js
UBounds.prototype.contains = function(latlng) {
if(latlng.lng()<this.getSouthWest().lng() || latlng.lng()>this.getNorthEast().lng() || latlng.lat()<this.getSouthWest().lat() || latlng.lat()>this.getNorthEast().lat())
return false;
else {
return true;
}
};
@blackbing
blackbing / auth_firebase_snippet.js
Created Dec 11, 2014
[Firebase] Dealing with Popups and Redirects in a better way
View auth_firebase_snippet.js
var ref = new Firebase("https://<your-firebase>.firebaseio.com");
rootRef.onAuth( function(authData){
//It is a better way to get authData instead of get from auth callback function
console.log(authData);
});
// prefer pop-ups, so we don't navigate away from the page
// auth callback is to handle if occur error
ref.authWithOAuthPopup("google", function(err) {
if (err) {
@blackbing
blackbing / gulpfile.coffee
Last active Aug 29, 2015
gulp task async and dependency demo
View gulpfile.coffee
gulp = require("gulp")
$ = require("gulp-load-plugins")()
gulp.task 'task1', (callback)->
setTimeout( ->
$.util.log( 'task1 done')
callback() #notice you need to send callback for chaining
, 1500)
You can’t perform that action at this time.