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
// @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) { |
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
[user] | |
name = bingo | |
email = [email protected] | |
[core] | |
diff = auto | |
status = auto | |
branch = auto | |
log = auto | |
excludesfile = /Users/bingo/.gitignore_global | |
editor = nvim |
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
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'; |
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
<!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> |
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
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'; |
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
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; | |
} | |
}; |
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
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) { |
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
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) |
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
query = (task, callback)-> | |
#do something | |
callback(task + ' finished') | |
#nested way | |
query('task1', (msg)-> | |
console.log msg | |
query('task2', (msg)-> | |
console.log msg | |
query('task3', (msg)-> |
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
[user] | |
name = bingo | |
email = [email protected] | |
[core] | |
diff = auto | |
status = auto | |
branch = auto | |
log = auto | |
excludesfile = /Users/bingo/.gitignore_global | |
editor = /usr/bin/vim |