Skip to content

Instantly share code, notes, and snippets.

View corbanb's full-sized avatar

corban baxter corbanb

View GitHub Profile
@corbanb
corbanb / pre-request-jwt.js
Last active February 21, 2024 14:47
JWT tokenize - Postman Pre-Request Script
function base64url(source) {
// Encode in classical base64
encodedSource = CryptoJS.enc.Base64.stringify(source);
// Remove padding equal characters
encodedSource = encodedSource.replace(/=+$/, '');
// Replace characters according to base64url specifications
encodedSource = encodedSource.replace(/\+/g, '-');
encodedSource = encodedSource.replace(/\//g, '_');
@corbanb
corbanb / JavaScript.sublime-build
Last active May 2, 2022 22:56
Sublime Text - Tools > Build System > New Build System
// Sublime Text - Build System for Javascript
{
"cmd": ["node", "$file"],
"selector": "source.js"
}
@corbanb
corbanb / api_cache.php
Created June 2, 2014 20:22
Simple API caching with PHP
<?php
/**
* API Request Caching
*
* Use server-side caching to store API request's as JSON at a set
* interval, rather than each pageload.
*
* @arg Argument description and usage info
*/
@corbanb
corbanb / dev-node.md
Last active June 1, 2021 13:49
OSX 10.10.X Node Developer Setup

Node.js + OSX 10.10.X

Outline

Below is a quick start guide to developing node.js on OSX. These tools and settings will give you just about everything you would need on a clean install of OSX 10.10.X to get setup and coding.

Install iTerm2

https://www.iterm2.com

Install XCode

@corbanb
corbanb / default.conf
Last active May 23, 2020 12:22
Nginx redirect assets to CDN from Wordpress
server {
## Your website name goes here.
server_name domainname.com www.domainname.com _;
## Your only path reference.
root /var/www/;
listen 8080;
## This should be in your http block and if it is, it's not needed here.
index index.html index.htm index.php;
include conf.d/drop;
@corbanb
corbanb / gist:76d0658493e93830af48
Last active February 28, 2020 22:02 — forked from kirley/gist:3913166
Setting up PostGIS for Timezone Lookup
#!/bin/bash
if [ "$GIT_SSH_KEY" != "" ]; then
echo "Cleaning up SSH config" >&1
echo "" >&1
# Now that npm has finished running,
# we shouldn't need the ssh key/config anymore.
# Remove the files that we created.
rm -f ~/.ssh/config
rm -f ~/.ssh/deploy_key
@corbanb
corbanb / profanity.csv
Created May 9, 2016 22:56 — forked from tjrobinson/profanity.csv
Profanity list for use with content filters
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
amcik
arse
arsehole
arserape
arsewipe
ass
asses
asshole
assholes
assramer
@corbanb
corbanb / cities.json
Created October 16, 2017 21:39 — forked from Miserlou/cities.json
1000 Largest US Cities By Population With Geographic Coordinates, in JSON
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
function create_branch_pr {
branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
remote=$(git config remote.origin.url | cut -d. -f1-2)
echo "$remote/compare/develop...updates/$branch"
}
alias opr='open -a /Applications/Google\ Chrome.app $(create_branch_pr)'