Skip to content

Instantly share code, notes, and snippets.

Jason Rudolph jasonrudolph

View GitHub Profile
@jasonrudolph
jasonrudolph / example-repository-redirects.md
Last active Aug 26, 2018
Preview Repository Redirects in the GitHub API
View example-repository-redirects.md

Repository redirects are coming to the GitHub API, and this functionality is now available for developers to preview. Let's try it out.

First, we need a repository that has been renamed or relocated. Since jasonrudolph/jasonrudolph.github.io was previously named jasonrudolph/jasonrudolph.com, we can use it as our guinea pig. 🌍🐖

We'll use curl for all of our examples below, and we'll include the --location option to instruct curl to follow any redirects that it encounters.

The Present

Using the current production version of the GitHub API, when we attempt to [access the repository](https://developer.github.com/v3/repos/#get

@jasonrudolph
jasonrudolph / request.sh
Created Apr 14, 2015
Get `starred_at` timestamp for a repository's stargazers via the GitHub API
View request.sh
curl https://api.github.com/repos/atom/atom/stargazers -H 'Accept: application/vnd.github.v3.star+json'
View request.sh
curl -H "Accept: application/vnd.github.v3.star+json" https://api.github.com/users/glaforge/starred
@jasonrudolph
jasonrudolph / github-api-example.md
Created Apr 15, 2014
Debugging "Reference update failed" error when creating a branch via the GitHub Git Refs API
View github-api-example.md
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active Mar 31, 2019
5 entertaining things you can find with the GitHub Search API
View 00-about-search-api-examples.md
@jasonrudolph
jasonrudolph / gist:6057563
Last active Apr 24, 2019
GitHub Search API: Get the number of stars for a repository
View gist:6057563

James Sugrue [asked][1], "@GitHubAPI is there a way to find the number of stars for a given repository?"

Example

$ curl -ni "https://api.github.com/search/repositories?q=more+useful+keyboard" -H 'Accept: application/vnd.github.preview'
{
View request.sh
# Search for code containing the term "_cache" in repositories owned by @jasonrudolph
curl -G -H "Accept: application/vnd.github.preview.text-match" \
https://api.github.com/search/code --data-urlencode "q=@jasonrudolph _cache"
@jasonrudolph
jasonrudolph / 00-about.md
Created Sep 21, 2012
Rough Notes from Strange Loop 2012
View 00-about.md
View snippet.rb
# A Ruby snippet posted as a comment on http://vitobotta.com/applying-bitwise-operations-to-rspec-testing/
# [ activable?, persisted?, new?, suspended? ]
# =============================================
combinations = [
[ false, false, false, false ],
[ false, false, true, false ],
[ false, false, false, true ],
[ false, true, false, false ],
@jasonrudolph
jasonrudolph / mongo-console
Created Jun 9, 2012
Passing Query and Sort Params to MongoHQ RESTful API
View mongo-console
# Assuming you're familiar with specifying query and sort options
# via the MongoDB console as shown here, you can specify these same
# options via the MongoHQ RESTful API using the approach shown in the
# file below.
$ mongo staff.mongohq.com:10095/one-rep-max -u REDACTED -p
MongoDB shell version: 2.0.4
Enter password:
connecting to: staff.mongohq.com:10095/one-rep-max
> use one-rep-max;
You can’t perform that action at this time.