Skip to content

Instantly share code, notes, and snippets.

View kremerben's full-sized avatar
👨‍💻
tippety tap, tippety tap

Ben Kremer kremerben

👨‍💻
tippety tap, tippety tap
  • Kremer Software and Design
  • San Francisco - Oakland, CA
  • 20:14 (UTC -07:00)
View GitHub Profile
@kremerben
kremerben / chatbuilder.html
Created October 15, 2013 08:27
Ben Kremer - Chat Built-er
<!DOCTYPE html>
<html>
<head>
<title>Ben Kremer's Chat App</title>
<meta charset="utf-8">
<script src="http://chatbuilder.hackreactor.com/ChatBuilder.js"></script>
</head>
<body>
<script>
delete Chat.display;
# /*
# * Given two numbers, find all factors of each.
# * Return all of their common factors sorted from highest to lowest.
# *
# * Example 1:
# * Find all the common factors of 12 and 18.
# * Factors of 12 are 12, 6, 4, 3, 2, 1
# * Factors of 18 are 18, 9, 6, 3, 2, 1
# * The common factors of 12 and 18 are 6, 3, 2, 1
# *
# Using the Python language, have the function IntersectingLines(strArr)
# take strArr which will be an array of 4 coordinates in the form: (x,y).
# Your program should take these points where the first 2 form a line and
# the last 2 form a line, and determine whether the lines intersect, and if
# they do, at what point.
# For example: if strArr is ["(3,0)","(1,4)","(0,-3)","(2,3)"], then the line
# created by (3,0) and (1,4) and the line created by (0,-3) (2,3)
# intersect at (9/5,12/5). Your output should therefore be the 2 points in
# fraction form in the following format: (9/5,12/5). If there is no denominator
# for the resulting points, then the output should just be the integers like so: (12,3).
@kremerben
kremerben / Generate RuleAnalytics15Minute data
Created July 14, 2016 00:48
Generate RuleAnalytics15Minute data from the django shell
import datetime
import pytz
from random import randint
from prism_analytics.models import *
tz = pytz.UTC
RULE_ID = 16
start = datetime.datetime(2016, 5, 13, 22, tzinfo=tz)
@kremerben
kremerben / gist:9b631b1c174cc0ca57dad4ec72e7d313
Last active June 10, 2020 07:06
ECMAScript 6 Cheat Sheet

ECMAScript 6 Cheat Sheet

Arrow functions

    x => x + 1                          // similar to function(x) {return x + 1;}
    (x, y) => x + y                     // similar to function(x, y) {return x + y;}
    x => {return x + 1}

Array destructuring

@kremerben
kremerben / spark_tutorial.md
Last active August 31, 2017 05:50
Get Spark up and running in a vagrant virtual machine

Get spark up and running:

$ vagrant init ubuntu/xenial64
$ vagrant up
$ vagrant ssh 
vm$ sudo apt-get update 
vm$ sudo apt-get install default-jre
vm$ sudo apt install python-pip
@kremerben
kremerben / bash_aliases.txt
Last active March 2, 2022 23:16
current ~/.bash_aliases - August 28, 2017
alias leetcode='cd ~/Dropbox/\ LEETCODE/ && jupyter notebook'
alias lc='leetcode'
alias leet='leetcode'
alias goopencv='deactivate || : && cd ~/Dropbox/\ CLASSES/LearnOpenCV_2021/ && source .venv/bin/activate && jupyter notebook'
#Energy Solution specific aliases
alias activate='source .venv/bin/activate'
alias act='activate'
alias deact='deactivate'
@kremerben
kremerben / adrdash_bash_aliases
Created October 31, 2018 18:26
Function to add to ~/.bash_aliases to update the ADR dashboard
adrdash ()
{
networksetup -connectpppoeservice "L2TP VPN";
open smb://username:password@192.168.25.13/Share/;
workon adr-dashboard;
git status;
git diff;
read -r -p "Everything good? Continue? [y/N] " response;
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
echo 'Continuing\n';
@kremerben
kremerben / apartment_list_group_picker
Last active October 9, 2019 02:56
Pick a group of 3-5 people for lunch
import random
people = ['alice', 'bob', 'carl', 'dave', 'asdf', 'sdfg', 'sdffg', 'erty', 'ertry']
people = [1,2,3,4,5,6,7,8,9]
def make_groups(people):
result_groups = []
current_group = []
@kremerben
kremerben / css-html-only-accordion-element.markdown
Last active June 10, 2020 07:05
CSS + HTML only Accordion Element

CSS + HTML only Accordion Element

Read the copy in the accordion sections for some info about how this was made.

A Pen by Ben Kremer on CodePen.

License.