Skip to content

Instantly share code, notes, and snippets.

View zspencer's full-sized avatar

Zee zspencer

View GitHub Profile
@zspencer
zspencer / embedding_in_node.js
Last active November 29, 2018 16:14
Implementation Strategies for Integrating External Services in your Application
const client = require('twilio')(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN);
class Person {
sendVerificationCode() {
client.messages
.create({
body: i18n__('verification_code', { verificationCode: this.verificationCode }),
to: this.mobileNumber, from: process.env.TWILIO_OUTGOING_NUMBER
})
.done();
}
# I frequently use ActiveModel::Type to define complex objects in my database. When doing
# so, there is always a moment when I run into a bug that is caused by me forgetting to
# support ActiveRecord knowing that the complex type is dirty!
# So here's a quick example that I can reference when I go to make a complex type again
# that plays nicely *with* ActiveModel::Dirty!
# frozen_string_literal: true
begin

Keybase proof

I hereby claim:

  • I am zspencer on github.
  • I am zspencer (https://keybase.io/zspencer) on keybase.
  • I have a public key ASAn-Zbj9I_z_uZTV5lT3lfUHI6-dnfLeBnbJQRV5Icmlgo

To claim this, I am signing this object:

b_favorite_color: true
function findFib(index) {
var values = [0,1];
if(index in values) { return values[index]; }
return findFib(index - 2) + findFib(index - 1);
}
function memoize(fn) {
var cache = {};
return function() {
var args = Array.prototype.slice.call(arguments);
@zspencer
zspencer / fizz-buzz.clj
Created April 17, 2015 15:07
Drop this into lighttable and Cmd+enter!
;; Anything you type in here will be executed
;; immediately with the results shown on the
;; right.
(defn fizz? [number]
(zero? (rem number 3)))
(fizz? 1)
(fizz? 3)
(fizz? 6)
(fizz? 10)
describe "Converting Arabic Numerals to Roman Numerals" do
NUMERAL_TRANSLATIONS = {
1 => "I",
2 => "II",
5 => "V",
10 => "X"
}
NUMERAL_TRANSLATIONS.each_pair do |arabic, roman|
it "converts #{arabic} to #{roman}" do
expect(arabic_to_roman(arabic)).to eql(roman)
---
layout: nil
---
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Musings and Mutterings of Zee Spencer</title>
<link rel="self" type="application/atom+xml" href="http://zeespencer.com/index.xml" />
<link href="http://zeespencer.com/" />
<updated>{{ site.time | date_to_xmlschema }}</updated>
$ curl -L -v www.apprenticeshipcommunity.com/
* Hostname was NOT found in DNS cache
* Trying 50.31.225.93...
* Connected to www.apprenticeshipcommunity.com (50.31.225.93) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: www.apprenticeshipcommunity.com
> Accept: */*
>
< HTTP/1.1 404 Not Found
@zspencer
zspencer / code.rb
Last active August 29, 2015 14:14
best times for hacking
OPTIMAL_SCHEDULE_MAPPING = {
:zspencer => [
"Friday 5-7PM PST",
"Wednesday 5-7PM PST",
"Wednesday 6-8PM PST",
"Saturday 10AM-11AM PST",
"Saturday 11AM-12PM PST",
"Sunday 10AM-11AM PST",
"Sunday 11AM-12PM PST"
],