Skip to content

Instantly share code, notes, and snippets.

@fpillet
fpillet / scale.js
Created May 26, 2011 12:07
Javascript value scaling between two ranges
/* Scale a value from one range to another
* Example of use:
*
* // Convert 33 from a 0-100 range to a 0-65535 range
* var n = scaleValue(33, [0,100], [0,65535]);
*
* // Ranges don't have to be positive
* var n = scaleValue(0, [-50,+50], [0,65535]);
*
* Ranges are defined as arrays of two values, inclusive
@nuc
nuc / upload-sourcemap.js
Last active March 27, 2019 06:12
Upload sourcemaps to Sentry
/* eslint-disable no-sync */
const request = require('superagent')
const path = require('path')
const fs = require('fs')
const ACCOUNT = 'account'
const PROJECT = 'project-name'
const TOKEN = 'your-token'
const ASSET_URL = 'https://example.com/assets'
const SOURCEMAPS_PATH = './temp'
@jylopez
jylopez / stripe_country_codes.js
Last active May 28, 2024 20:53
Stripe Country Codes
[
{ country: 'Australia', code: 'AU' },
{ country: 'Austria', code: 'AT' },
{ country: 'Belgium', code: 'BE' },
{ country: 'Brazil', code: 'BR' },
{ country: 'Bulgaria', code: 'BG' },
{ country: 'Canada', code: 'CA' },
{ country: 'Croatia', code: 'HR' },
{ country: 'Cyprus', code: 'CY' },
{ country: 'Czech Republic', code: 'CZ' },