Open petrosh opened 9 years ago
414 Request-URI Too Large
API Links
test user
octokat.js
Get first commit of a repository
var url = 'https://api.github.com/repos/' + username + '/' + githubRepository;
cb = function issues(json){
console.log(json.created_at);
var url1 = 'https://api.github.com/repos/' + username + '/' + githubRepository + '/commits?per_page=1&until=' + json.created_at;
var cb1 = function first(json){
console.log(json);
};
go(url1,cb1);
};
go(url,cb);
Append <script>
<html>
<head>
<script type="text/javascript">
function foo(response) {
var meta = response.meta;
var data = response.data;
console.log(meta);
console.log(data);
}
var script = document.createElement('script');
script.src = 'https://api.github.com?callback=foo';
document.getElementsByTagName('head')[0].appendChild(script);
</script>
</head>
<body>
<p>Open up your browser's console.</p>
</body>
</html>
Gist embed GitHub
<script src="https://gist.github.com/mbostock/4063550.js?file=flare.json"></script>
<!-- https://gist.github.com/<USERNAME>/<GIST ID>.js?file=<FILENAME> -->
Wikis
https://raw.github.com/wiki/[owner]/[repository]/[page].md
Wiki Page URL
https://github.com/owner/repository/wiki/Wiki-Page
Append .md
https://github.com/owner/repository/wiki/Wiki-Page.md
Redirected to raw URL
https://raw.githubusercontent.com/wiki/owner/repository/Wiki-Page.md
Example: https://github.com/reinterpretcat/utymap/wiki/Install-on-Linux
GET /users/:username/hovercard?subject_type=repository&subject_id=1300192
by organization owner to a repository
{
"contexts": [
{
"message": "Committed to this repository in the past week",
"octicon": "git-commit"
},
{
"message": "Member of @riminino and 5 more",
"octicon": "organization"
}
]
}
by guest logged with public_repo
token scope
Hovercard error Not Found
by guest logged with repo
token scope needed for "contextual information API"
{
"contexts": [
]
}
gh-pages
Publishing with GitHub Pages, now as easy as 1, 2, 3
theme
not specified in site's config (Jekyll Default Layout)Gem | version |
---|---|
jekyll | |
jekyll-swiss |
Simpler GitHub Pages publishing
Selecting master branch will publish your site from the master branch. This is useful for repositories dedicated to website content.
Selecting master branch /docs folder will publish from the /docs folder of your master branch. This lets you maintain documentation and code together on one branch, and open source maintainers can accept contributions for both in a single pull request.
Better discoverability for GitHub Pages sites
By simply adding the {% seo %}
tag to your site's template Jekyll will automatically add the appropriate search engine metadata to each page.
<html>
<head>
{% include head.html %}
{% seo %}
</head>
</html>
Exposed metadata
Links
git log --grep
List of all files changed in a commit
git diff-tree --no-commit-id --name-only -r <commit-ish>
Curl
curl -i "https://api.github.com/repos/raveup/raveup.github.io/commits?path=assets&until=2016-01-01T00:00:49Z"
Branches
git checkout -b branch-name
git branch -d branch-name
Remote: git push origin :branch-name
source-folder
from a source-branch
in another destination-branch
git checkout source-branch
git subtree push --prefix source-folder origin destination-branch
git.io
curl -i http://git.io -F "url=https://github.com/petrosh/snippetrosh/issues" -F "code=snippetrosh"
tags
git tag
git show v0.2
git tag -a v0.1 9bfeb5b
(press q
to exit message) or git tag -a v1.4 -m "my version 1.4"
git push origin --tags
git fetch
git submodule add https://github.com/petrosh/submodules-posts _posts
git submodule update --remote --merge
git commit -am "ok" && git push
# ----------
# .gitignore
# ----------
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
[bottom page](#partial-new-comment-form-actions)
https://github.com/:owner/:repository/find/:branch
topic:"rpg" "rpg-engine"
https://github.com/:owner/:repo/new/:branch?filename=:filename.ext&value=:content&message=:commit_message&description=:commit_description
ProTip™: You can pre-fill the filename field using just the URL. Typing ?filename=yournewfile.txt at the end of the URL will pre-fill the filename field with the name yournewfile.txt.
filename
- file path and filename.extensionvalue
- file content (encode-uri)message
- commit messagedescription
- commit descriptionRemember to encode_uri
so space is %20
, newline is %0A
...
title
body
assignee
milestone
labels[]
Add #new_comment_field
to focus on textarea.
Code
$.ajaxSetup
url: "{{ site.github.api_url }}/graphql"
headers: "Authorization": "token #{storage.get 'login.token'}"
type: "POST"
jery = $.ajax data: JSON.stringify { query:
'query{viewer{login}repository(owner:"riminino", name:"graf"){viewerPermission isFork}}'
}
jery.done (data, status) -> console.log data, status
jery.fail (request, status, error) -> console.log status, error
Viewer
query{
viewer{
login
}
}
{
"data": {
"viewer": {
"login": "trasparente"
}
}
}
All fields
query {
__type (name: "Repository") {
fields {
name
description
}
}
}
Repository
query {
repository (owner: "riminino", name: "barebone") {
viewerCanAdminister
viewerPermission
}
}
{
"data": {
"repository": {
"viewerCanAdminister": true,
"viewerPermission": "ADMIN"
}
}
}
Deployments
query{
repository(owner:"riminino", name:"barebone") {
deployments(last: 1) {
edges {
node {
commit {
oid
}
task
updatedAt
}
}
}
}
}
{
"data": {
"repository": {
"deployments": {
"edges": [
{
"node": {
"commit": {
"oid": "119d18999a0908097358500fa47ca29d2c4bd1c7"
},
"task": "deploy",
"updatedAt": "2020-04-15T14:04:32Z"
}
}
]
}
}
}
}
Rate limit
query{
rateLimit{
cost
limit
nodeCount
remaining
resetAt
}
}
{
"data": {
"rateLimit": {
"cost": 1,
"limit": 5000,
"nodeCount": 0,
"remaining": 4990,
"resetAt": "2020-04-15T21:32:32Z"
}
}
}
gh-pages
.gitignore
GraphQL