Skip to content

Instantly share code, notes, and snippets.

@jimmyjacobson
jimmyjacobson / algos.js
Created July 13, 2017 17:33
Intro to Algorithms
/*
original [7,4,12,39,6.5,88,78,-3,14.7,3.14,359]
pass 1 [-3,7,12,39,6.5,88,78,4,14.7,3.14,359]
pass 2 [-3,3.14,12,39,7,88,78,6.5,14.7,4,359]
pass 3 [-3,3.14,4,39,12,88,78,7,14.7,6.5,359]
We want to sort this array from smallest to largest
1. Look at each number in the array
2. Look at each number that comes after that number
@jimmyjacobson
jimmyjacobson / a_string_is_not_an_error.md
Last active December 27, 2021 20:49
A String is not an Error

A String is not an Error

Why Error Handling?

  • Default behavior for programs is to terminate on an error, or enter the debugger
  • Terrible user experience

Why Handle Errors?

  • Gracefully Handle Errors (retry connections, re-prompt for user input, etc)
  • Non Local Control Flow (Display error messages and screens)
@jimmyjacobson
jimmyjacobson / embedded.js
Last active August 29, 2015 14:08
Cross Domain Message Passing
/*
This code goes in the webpage that is embedded via iframe.
Use of JQuery is assumed in this example
*/
function postMessage() {
var msg = $('body').height();
window.parent.postMessage(msg, '*');

Twilio - Wedgies Walkthrough

Store your Wedgies API key in an environment variable and reference in a global variable.

var WEDGIES_API_KEY = process.env.WEDGIES_API_KEY;

This is the express route to handle the incoming Twilio SMS

app.post('/', function(req, res, next) {
@jimmyjacobson
jimmyjacobson / vegasjs_hacknight_1.md
Last active August 29, 2015 14:06
VegasJS Hack Night #1
@jimmyjacobson
jimmyjacobson / vegasjs_31_reboot.md
Created August 20, 2014 05:15
VegasJS 31: Reboot

VegasJS 31: Reboot

Roundtable discussion about the future of VegasJS

Board

We decided to form a board of 3-5 people that will be in charge of scheduling meet ups, point of contacts for sponsors, and general welfare of the meet up.

The first board members are:

  • Jen Wilhelm
  • Ethan Duggan
@jimmyjacobson
jimmyjacobson / wedgies-embed.md
Last active August 29, 2015 14:05
Embedding a Wedgie Poll on your Website

Embedding a Wedgie Poll on your Website

Wedgies is a platform for real time polls across social channels. You can create a question on Wedgies.com and share it to Facebook or Twitter immediately. You can also use our widget to embed the question on your website or blog and gather responses while creating engagement. We have provided javascript, iframe and WordPress plugin solutions to help you get started.

Javascript

Example on CodePen

<script src='https://www.wedgies.com/js/widgets.js'></script>
var url = 'https://api.themoviedb.org/3/movie/';
imdb_id = 'tt0102685';
key = '?api_key=9a2c8fe3fd95dcd12c59204ad2899b9e';
append = '&append_to_response=credits';
$.ajax({
type: 'GET',
url: url + imdb_id + key + append,
dataType: 'jsonp',
success: function(data) {
var _draw = function() {
var angle = 90,
total = 0,
start = 0,
stroke = Raphael.rgb(52,125,168),
process = function (j) {
if(j == voted){
color = Raphael.rgb(235,194,0);
} else {
color = Raphael.rgb(200,200,200);