Skip to content

Instantly share code, notes, and snippets.

@josephmosby
josephmosby / Sum-of-greatest-two
Created September 15, 2014 18:20
Saving accomplishments in Lisp because parentheses
(define (find-largest x y z)
(cond ((and (> x y) (> x z)) x)
((and (> y z) (> y x)) y)
((and (> z x) (> z y)) z)))
(define (find-second-largest x y z)
(cond ((and (> y x) (< y z)) y)
((and (> z y) (< z x)) z)
((and (> x z) (< x y)) x)))
@josephmosby
josephmosby / sqrt
Last active August 29, 2015 14:06
Mechanisms for describing a square root function, from MIT
(define (average x y)
(/ (+ x y) 2))
(define (improve guess x)
(average guess (/ x guess)))
(define (good-enough? guess x)
(< (abs (- (square guess) x)) 0.001))
(define (sqrt-iter guess x)
@josephmosby
josephmosby / jobs
Created September 18, 2014 20:31
Steve Jobs challenging Wendell Weeks
"We don't have the capacity," Weeks replied. "None of our plants make the glass now."
"Don't be afraid," Jobs replied. This stunned Weeks, who was good-humored and confident but not used to Jobs's reality distortion field. He tried to explain that a false sense of confidence would not overcome engineering challenges, but that was a premise that Jobs had repeatedly shown he didn't accept. He stared at Weeks unblinking." "Yes, you can do it," he said. "Get your mind around it. You can do it."
As Weeks retold this story, he shook his head in astonishment. "We did it in under six months," he said. "We produced a glass that had never been made."
@josephmosby
josephmosby / listexercise.py
Last active August 29, 2015 14:06
Python exercise with lists
presidents = ["George Washington", "Thomas Jefferson", "Theodore Roosevelt", "Abraham Lincoln", "William Howard Taft"]
for president in presidents:
print president
if president == "Teddy Roosevelt":
print "Teddy wins!"
@josephmosby
josephmosby / pcampdc1.txt
Created October 11, 2014 15:03
Notes from Rachel Petersen's discussions on surveying audience
SurveyMonkey, Cvent great surveying resources
How do I improve survey responses?
1. Work backwards
- what question am I trying to answer?
- what data do I need to answer the question?
- what type of survey should I use to collect this data?
- to whom should I ask the question
@josephmosby
josephmosby / hiring.txt
Created October 11, 2014 17:39
Who's hiring at ProductCampDC?
Jessica Hall - 3Pillar Global - looking for a senior UX role, focusing on PM and software/product
Dustin Levy - Gentex Corporation - looking for a product manager in SoCal, a marketing communications role in Boston, and a customer service leader in HQ
Amy - LivingSocial - looking for product managers on the consumer side (versus merchant or internal), also looking for Ruby devs
Shireen B - LearningObjects - junior product manager
Mina Rath - K12 - senior director of product managers
@josephmosby
josephmosby / stripe_test.py
Created October 16, 2014 14:03
Walk through a default JS-powered Stripe Checkout using Python and Selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest as ut
import time
class NewPaymentTest(ut.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
@josephmosby
josephmosby / webform.php
Created October 23, 2014 14:42
Webform.php
function pls_webform_element($variables) {
$element = $variables['element'];
$value = $variables['element']['#children'];
$wrapper_classes = array(
'form-item',
);
$output = '<div class="' . implode(' ', $wrapper_classes) . '" id="' . $element['#id'] . '-wrapper">' . "\n";
$required = !empty($element['#required']) ? '<span class="form-required" title="' . t('This field is required.') . '">*</span>' : '';
@josephmosby
josephmosby / hide
Created October 24, 2014 14:12
Hide all icons on Desktop but not in ~/Desktop
defaults write com.apple.finder CreateDesktop -bool false && killall Finder
@josephmosby
josephmosby / lazy_init.py
Last active August 29, 2015 14:08
Lazy Initialization
class Fruit:
def __init__(self, sort):
self.sort = sort
class Fruits:
def __init__(self):
self.sorts = {}
def get_fruit(self, sort):
if sort not in self.sorts: