Skip to content

Instantly share code, notes, and snippets.

View jeanmw's full-sized avatar

Jean Weatherwax jeanmw

  • First Round Capital
  • San Francisco
View GitHub Profile
@jeanmw
jeanmw / gist:38361dfb70b056961744e3d1765da00c
Created August 26, 2021 00:27
Infinite python number generator
# Write a one-line Python generator expression that provides an infinite stream
#of unique integers that are evenly divided by any of the ascii values for
#the characters in “jean”.
# There are likely many ways to do this correctly.
# I have made some assumptions - that sequential ordering is alright,
# and that although python3 technically does not have a integer limit
# we want to have some kind of reasonable size limit based on max pointer size
# If we were in python 2 we would need to limit the range to sys.maxint
# I have explicitly imported things here as well just for clarity although
@jeanmw
jeanmw / AtomPlugins.md
Created May 10, 2017 22:19 — forked from ladydangerdame/AtomPlugins.md
Make your life as a Web Developer easier with these Atom plugins!

Open up your settings in Atom, select 'install' from the menu on the left and search for these helpful plugins:

1. Atom-beautify

    Probably the best of all... Clean up and indent HTML, CSS, JavaScript, PHP, Python, Ruby and more...!
    Right click to use!

2. Open-in-browser

Pretty obvious by the name, allows you to open files in your browser from Atom by right clicking!

//a nifty piece of code from the internet that provides entertainment
function findAndReplace(searchText, replacement, searchNode) {
if (!searchText || typeof replacement === 'undefined') {
console.log("bad input!");
return;
}
var regex = typeof searchText === 'string' ?
new RegExp(searchText, 'g') : searchText,
childNodes = (searchNode || document.body).childNodes,
@jeanmw
jeanmw / isPrime.js
Last active August 2, 2017 22:39
Iterative and recursive methods to find if a number is a prime in JavaScript
function isPrime(num) {
var count = 2;
while(count < num) {
if(num % count == 0) {
return false;
}
count ++;
}
return true;
}
function reverseLinkedList(node) {
var reversedPart = {
data: null,
next: null
}
var current = node;
while(current) {
let nextNode = current.next;
current.next = reversedPart;
reversedPart = current;
@jeanmw
jeanmw / addTwoBinaries.js
Last active August 15, 2020 14:56
js function to add two binary number strings
function addTwoBinaries(a,b) {
///we need to track the carry value
//we also need to track the sum which will the be result
let carry = 0;
let result = "";
//we will need to do the add and carry operation at least as many times as the
//longest number, so let's keep track of two lengths for iteration
let i = 0;
let j = 0;
//while we have digits left on each, lets do the sum and carry
@jeanmw
jeanmw / authentication_with_bcrypt_in_rails_4.md
Created December 15, 2016 18:11 — forked from eerwitt/authentication_with_bcrypt_in_rails_4.md
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

@jeanmw
jeanmw / Trie.java
Created October 14, 2016 20:22
Sample Trie implementation for Autocomplete in Java, targeted for medical data
import java.util.*;
/**
* Created by jeanweatherwax on 10/15/15.
*/
public class Trie {
protected final Map<Character, Trie> children;
protected String content;
protected boolean terminal = false;