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
// Use @substats, a open source repo on @Github, to fetch all my social medias' stats | |
const url = "https://api.spencerwoo.com/substats/?source=weibo&queryKey=2028434647&source=twitter&queryKey=zwithz1998&source=jikeFollower&queryKey=e1377acb-40ed-495e-9a73-158273b4090a" | |
const req = new Request(url) | |
const json = await req.loadJSON() | |
const data = json.data.subsInEachSource | |
const twitterFollowers = data.twitter |
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
--- | |
version: '2' | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:latest | |
environment: | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
ZOOKEEPER_TICK_TIME: 2000 | |
kafka: |
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
{ "index" : { "_index" : "products" } } | |
{"name": "MacBook Pro Touch Bar Laptop With 13.3-Inch Retina Display, Core i5 with 1.4GHz Quad Core Processor/8GB RAM/128GB SSD/Intel Iris Plus Graphics 645/English Keyboard 2019 Space Gray", "attributes": {"brand": "Apple", "processorType": "Core i5"} } | |
{ "index" : { "_index" : "products" } } | |
{"name": "MacBook Air With 13.3-Inch Retina Display, Core i3 Processor/8GB RAM/256GB SSD/Intel Iris Plus Graphics With English Keyboard 2020 Space Gray", "attributes": {"brand": "Apple", "processorType": "Core i3"} } | |
{ "index" : { "_index" : "products" } } | |
{"name": "MacBook Air 13.3-Inch, Core i5 with 1.8GHz Dual Core Processor/8GBRAM/128GB SSD/Intel HD Graphics 6000 - 2017 Silver", "attributes": {"brand": "Apple", "processorType": "Core i5"} } | |
{ "index" : { "_index" : "products" } } | |
{"name": "Macbook Pro With Touch Bar And Touch ID, 13.3-Inch Display, Core i5, 8th Generation,1.4 Ghz Quad Core Processor/8GB RAM/256GB SSD/Intel Iris Plus Graphics 645/Retina Display, English Keybo |
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
pull-latest() { | |
for dir in $(find . -name ".git") | |
do cd ${dir%/*} | |
echo $PWD | |
git reset --hard HEAD | |
git checkout develop | |
git pull origin develop | |
if [ -f "./package.json" ]; then | |
yarn install | |
fi |
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
get_latest_release() { | |
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
grep '"tag_name":' | # Get tag line | |
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
} | |
# Usage | |
# $ get_latest_release "creationix/nvm" | |
# v0.31.4 |
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
To use in react-native, choose from font below, and then add to style element: | |
<Text style={{ fontFamily: 'Arial' }}>Arial Font</Text> | |
Alternatively, add your own custom font face | |
Android: | |
======== | |
normal |
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
// Implementation in ES6 | |
function pagination(c, m) { | |
var current = c, | |
last = m, | |
delta = 2, | |
left = current - delta, | |
right = current + delta + 1, | |
range = [], | |
rangeWithDots = [], | |
l; |
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
import 'dotenv/config'; | |
import * as grpc from 'grpc'; | |
import { protoIndex } from './proto'; | |
import greeterHandler from './handlers/greeter'; | |
protoIndex(); | |
const port: string | number = process.env.PORT || 50051; |
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
import * as grpc from 'grpc'; | |
import { HelloRequest, HelloResponse } from './proto/greeter/greeter_pb'; | |
import { GreeterService, IGreeterServer } from './proto/greeter/greeter_grpc_pb'; | |
class GreeterHandler implements IGreeterServer { | |
/** | |
* Greet the user nicely | |
* @param call | |
* @param callback |
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
import './greeter/greeter_pb'; | |
import './greeter/greeter_grpc_pb'; | |
export const protoIndex:any = ():void => { | |
}; |
NewerOlder