Step 1. Login to your github account.
Step 2. In top navigation bar click on Gist.
Step 3. Name your gist or name as same as your file name and paste your code inside it. Save your gist as Public Gist so it can access any where.
Step 4. Now once you save your gist copy the URL of that Gist from address bar of browser and paste it into your wordpress post.