Skip to content

Instantly share code, notes, and snippets.

View blixit's full-sized avatar

Blixit blixit

View GitHub Profile
@edudobay
edudobay / git-branch-protection.md
Last active June 27, 2023 13:02
Command-line script for protecting/unprotecting branches in a GitHub repository

(To be improved)

Requirements

  • httpie (which provides the http command) — pip install httpie

Setup

  • Save the git-branch-protection.sh as git-branch-protection somewhere in your path (something like ~/bin or ~/.local/bin if you already use it)
  • Generate a GitHub token and save it as ~/.config/github_token.
@sclark39
sclark39 / InstagramIdConvert.js
Last active July 18, 2023 11:59
Convert from Instagram Shortcode to Id and Back using big-integer
var bigint = require( 'big-integer' )
var lower = 'abcdefghijklmnopqrstuvwxyz';
var upper = lower.toUpperCase();
var numbers = '0123456789'
var ig_alphabet = upper + lower + numbers + '-_'
var bigint_alphabet = numbers + lower
function toShortcode( longid )
@tjamps
tjamps / README.md
Last active February 29, 2024 14:57
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :