Skip to content

Instantly share code, notes, and snippets.

View gvn's full-sized avatar
🥀
technopagan is the term

Gavin Suntop gvn

🥀
technopagan is the term
View GitHub Profile
@gvn
gvn / geometric-js.md
Created February 14, 2014 19:18
Geometric Functions in Javascript

Geometric Functions in Javascript

Distance between 2 points

function distance(x1, y1, x2, y2) {
  return Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));
}

JS Punctuation Preprocessor

Before

function blah()
  console.log('blah')

  if (foo === 1)
 bar = 2

Keybase proof

I hereby claim:

  • I am gvn on github.
  • I am gvn (https://keybase.io/gvn) on keybase.
  • I have a public key whose fingerprint is 45E7 D73E 4EB9 17E6 9E1C 4BB6 7B8F D5AF 5D35 96B6

To claim this, I am signing this object:

@gvn
gvn / LED.md
Last active August 29, 2015 14:00

LED Bulb Mania

Bulbs Tried

Satco S9041 8 Watt (50 Watt) 540 Lumens R20 LED Cool White 4000K 106 Beam Ditto Light Bulb, Dimmable

Tried 6 in kitchen. Clinical white, not bad. Good cooking light. Highest buzzing with Lutron Maestro CL dimmer. Small almost traditional bulb size.

Grimaldi R20 LED Recessed Light - 4 Watts - 2900K - 380 Lumens - Equivalent to a 45W Philips Incandescent Reflector Bulb

@gvn
gvn / index.html
Last active August 29, 2015 14:08
Pure CSS Bubble Steps
<ol class="steps">
<li>
<a class="current" href="#"><span class="number">1</span> Choose</a>
</li>
<li>
<a href="#"><span class="number">2</span> Details</a>
</li>
<li>
@gvn
gvn / react-notes.md
Last active August 29, 2015 14:10
React Notes

React Notes

JSX is a JavaScript syntax extension that looks similar to XML. You can use a simple JSX syntactic transform with React.

You don't have to use JSX with React. You can just use plain JS. However, we recommend using JSX because it is a concise and familiar syntax for defining tree structures with attributes.

React can either render HTML tags (strings) or React components (classes).

React's JSX uses the upper vs. lower case convention to distinguish between local component classes and HTML tags.

@gvn
gvn / mofo-testing.md
Last active August 29, 2015 14:16
Mofo Testing

Mofo Testing Notes

General approach for functional testing:

Do programmatic user interactions via headless browser and analyze the resulting DOM mutations.

PhantomJS

  • Gotcha: Phantom 2 downloaded from official site doesn't work on Yosemite. Get a working binary here.
  • mocha-phantomjs looks promising but isn't on 2 yet.
@gvn
gvn / binding.js
Created June 19, 2012 23:53
event binding pattern
window.Component = {
init: function () {
var self = this;
self.events.parent = self;
self.callbacks = {};
},
events: {
actionHappened: function (event) {
var self = this.parent;
@gvn
gvn / somen-tempeh-broccoli
Created July 11, 2012 02:58
Somen with Tempeh and Broccoli
Somen with Tempeh and Broccoli
- Tempeh brick
- Broccoli florets
- Canola oil
- 1 tbsp Maple Syrup
- 1 tbsp Tamari
- 1 tbsp Water
- 1/4 tsp liquid smoke
- Somen noodles (1 bundle broken in half)
@gvn
gvn / jsproto.js
Created August 15, 2012 20:48
JS Prototype Fun
Function.prototype.times = function (times) {
while (times) {
this.call();
times--;
}
}