Skip to content

Instantly share code, notes, and snippets.

Brad bradparker

Block or report user

Report or block bradparker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bradparker
bradparker / anthropology
Last active Aug 29, 2015
Anthropology - Charlie Parker
View anthropology
|-------------------------|-------------------------|-------------------------|-------------------------|
|-------------------------|-------------------------|-------------------------|-------------------------|
|----7--------8--6--7--10-|----------8-----10-8-----|----7--8--7-----------7--|-------------------------|
|-8-----10-9--------------|-------------------------|-------------10-7--8-----|-10----8--7-----------8--|
|-------------------------|-------------------------|-------------------------|----10-------------------|
|-------------------------|-------------------------|-------------------------|-------------------------|
| + - + - + - + - | + - + - + - + - | + - + - + - + - | + - + - + - + - |
|-------------------------|-------------------------|-------------------------|-------------------------|
|-------------------------|-------------------------|----------------9-----7--|-8-----------------------|
View tuning-fork.js
var context = new AudioContext(),
gainNode = context.createGain(),
oscillator = context.createOscillator();
gainNode.connect(context.destination);
oscillator.frequency.value = 440;
oscillator.connect(gainNode);
oscillator.start();
// ..
// gainNode.gain.value = 0;
View unit-matcher.js
// Take "3mm", "-3inches", or "3.45 cm" and return ['3', 'mm'], ['-3', 'inches'], ["3.45", "cm"] etc
function unitParse (str) {
return (str.match(/([-\d.]+)\s+?([A-Za-z]+)/) || []).slice(1)
}
@bradparker
bradparker / line-slope-intercept.js
Created Dec 31, 2014
Line, slope intercept form
View line-slope-intercept.js
function Line (slope, intercept) {
this.slope = slope
this.intercept = intercept
}
function getX (y) {
y = y || 0
return (y - this.intercept) / this.slope
}
Line.prototype.getX = getX;
View cons.js
const cons = (a, b) =>
(member) => {
if (member === 1) {
return a
} else if (member === 2) {
return b
}
}
const car = (pair) =>
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Scratch pad</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/2.2.5/mocha.min.css" />
</head>
<body>
<div id="mocha"></div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/chai/3.2.0/chai.min.js"></script>
@bradparker
bradparker / a_ok.rb
Created Sep 9, 2015
Well this is, unsurprisingly, fine
View a_ok.rb
(1..10e6).map {
SecureRandom.uuid
}.reduce(Hash.new(0)) { |counts, uuid|
counts[uuid] += 1
counts
}.values.uniq
View rough-outline-of-steps.md

Rough outline of the steps in an isolated design job

  • Define project objectives
  • Review identity standards
  • Develop concepts and prototypes (The Design process)
  • Present solution
  • Evaluate solution (Maybe loops back to Develop)
  • Prepare for production
  • Evaluate finished piece(s) (Maybe loops back to Develop)
  • Deliver finished files for production / distribution
@bradparker
bradparker / method-compose.js
Created Nov 17, 2015
Smoosh two object's methods together
View method-compose.js
const { keys, assign } = Object
const concern = {
doSideEffectyThing () {
this.property1 = 'Hip, hip!'
}
}
const instance = {
someProp: 'Foo',
View reduced.js
const range = (start, end) =>
Array.from({
length: end - start
}).map((_, index) => (index + start))
const sum = nums =>
nums.reduce((total, num) => total + num)
sum(range(20, 100))
You can’t perform that action at this time.