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
// Try at : https://graphql-explorer.githubapp.com/ | |
// With query variables below | |
// { "queryString": "language:JavaScript stars:>10000" } | |
query SearchMostTop10Star($queryString: String!) { | |
search(query: $queryString, type: REPOSITORY, first: 10) { | |
repositoryCount | |
edges { | |
node { | |
..._Repository |
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
// Try at : https://graphql-explorer.githubapp.com/ | |
// With query variables below | |
// { "queryString": "language:JavaScript stars:>10000" } | |
query SearchMostTop10Star($queryString: String!) { | |
search(query: $queryString, type: REPOSITORY, first: 10) { | |
repositoryCount | |
edges { | |
node { | |
... on Repository { |
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
// Try at : https://graphql-explorer.githubapp.com/ | |
{ | |
search(query: "language:JavaScript stars:>10000", type: REPOSITORY, first: 10) { | |
repositoryCount | |
edges { | |
node { | |
... on Repository { | |
name | |
descriptionHTML | |
stargazers { |
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
// Will print... [2016-11-09T07:52:09.303Z] foo bar | |
// ES6 | |
var _log = _log || console.log; | |
console.log = (...arguments) => { | |
arguments.unshift(`[${new Date().toISOString()}]`) | |
_log.apply(console, arguments); | |
}; | |
console.log('foo', 'bar'); | |
// ES5 |
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
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
if #available(iOS 10.0, *) { | |
// iOS 10+ | |
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in | |
print("Notifications access granted: \(granted.description)") | |
} | |
application.registerForRemoteNotifications() | |
} else { | |
// iOS 8, 9 |
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
// Try at : https://graphql-explorer.githubapp.com/ | |
query { | |
repositoryOwner (login: "facebook") { | |
repositories { | |
totalCount | |
} | |
repository(name: "react") { | |
description | |
forks { | |
totalCount |
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
// Try at : https://graphql-explorer.githubapp.com/ | |
// With query variables below | |
// {"name": "react", "login": "facebook", "states": "CLOSED"} | |
query GetRepositoryIssues($states: [IssueState!], $name: String!, $login: String!) { | |
repositoryOwner(login: $login) { | |
repository(name: $name) { | |
issues(last: 10, states: $states) { | |
edges { | |
node { | |
title |
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
resolve: () => { | |
return new Promise((resolve, reject) => { | |
db.collection('todos').find({}).toArray((err, todos) => { | |
if (err) reject(err) | |
else resolve(todos) | |
}) | |
}) | |
} |
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
# Install Docker on Ubuntu 14.04.4 x64 | |
# Ref https://docs.docker.com/engine/installation/linux/ubuntulinux/ | |
# No interactive for now. | |
export DEBIAN_FRONTEND=noninteractive | |
# Update your APT package index. | |
apt-get -y update | |
# Update package information, ensure that APT works with the https method, and that CA certificates are installed. | |
apt-get -y install apt-transport-https ca-certificates | |
# Add the new GPG key. | |
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D |
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
## Setup Docker | |
NETWORK_NAME=${1:-my-mongo-cluster} | |
REPLICASET_NAME=${2:-my-mongo-set} | |
# Disconnect old container if has. | |
docker network disconnect -f $NETWORK_NAME mongo0 | |
docker network disconnect -f $NETWORK_NAME mongo1 | |
docker network disconnect -f $NETWORK_NAME mongo2 | |
# Remove old network if has. | |
docker network rm $NETWORK_NAME |