This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.
I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)
Before trying it out DIY, I considered using:
| const cheerio = require('cheerio') | |
| const html = ` | |
| <ul> | |
| <li>Hello A</li> | |
| <li>Hello B</li> | |
| <li>Hello C</li> | |
| </ul> | |
| ` | |
| const $ = cheerio.load(html) |
In your command-line run the following commands:
brew doctorbrew update
| import { createCipheriv, createDecipheriv, randomBytes } from "crypto"; | |
| const ENCRYPTION_KEY: string = process.env.ENCRYPTION_KEY || ""; // Must be 256 bits (32 characters) | |
| const IV_LENGTH: number = 16; // For AES, this is always 16 | |
| /** | |
| * Will generate valid encryption keys for use | |
| * Not used in the code below, but generate one and store it in ENV for your own purposes | |
| */ | |
| export function keyGen() { |
####Rets Rabbit http://www.retsrabbit.com
Rets Rabbit removes the nightmare of importing thousands of real estate listings and photos from RETS or ListHub and gives you an easy to use import and Web API server so you can focus on building your listing search powered website or app.
Using Bookshelf.js with postgis and knex-postgis is a huge pain in the ass.
TLDR - Override Bookshelf methods to parse postgis formats in JS, not in SQL to avoid having to do awkward Bookshelf modifications anywhere you make a bookshelf insert/update/delete on Geo data (middleware like approach)
class Event extends Bookshelf.Model {
get tableName() { return 'event'; }
This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12
- Installing Homebrew is effortless, open Terminal and enter :
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :
| // Fix iOS Audio Context by Blake Kus https://gist.github.com/kus/3f01d60569eeadefe3a1 | |
| // MIT license | |
| (function() { | |
| window.AudioContext = window.AudioContext || window.webkitAudioContext; | |
| if (window.AudioContext) { | |
| window.audioContext = new window.AudioContext(); | |
| } | |
| var fixAudioContext = function (e) { | |
| if (window.audioContext) { | |
| // Create empty buffer |