Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kevincolten
kevincolten / notes.md
Last active August 29, 2015 14:26
Notes

brew install mysql

mysql.server start

mysql -uroot

sudo /usr/bin/Weavedssh22.sh start|stop|restart

sudo /usr/bin/Weavedweb80.sh start|stop|restart

@kevincolten
kevincolten / protocol.md
Last active August 29, 2015 14:25
Tornado Sandbox

ClientDataStore operations

Stores actual columns of data on the client. Used by lightweight "data source" models. Supports performing the following CRUD operations.

  • create new columns

  • replace all columns

@kevincolten
kevincolten / post.md
Last active August 29, 2015 14:25
@post Backbone + React: or, How I Came to Stop Looking for an Example and Built My Own

This tutorial came out of many frustrating google searches trying to find a decent end-to-end boilerplate example of incorporating React as the view component in Backbone. The three components I wanted in a tutorial were:

  1. Build something more than a single page TODO
  2. Involved routing and controllers
  3. Included a build process using a modern build tool
  4. Optimization and source-mapping
  5. Done in an organized manner with descriptive naming patterns

What we'll be building in this tutorial is a basic blog viewer. The source can be found here and the finished product can be found here. When complete, we'll be able to write the blog post in markdown in a gist with the title starting with a key word (ex. @post Here's My Post Title!) and display it in all its html glory.

So let's get started.

@kevincolten
kevincolten / ocean_plot.py
Last active August 29, 2015 14:24
Ocean Plot
from bokeh.embed import components
from bokeh.models import AjaxDataSource, Callback, Slider
from bokeh.plotting import figure, output_file, show, vplot
from jinja2 import Template
import webbrowser
import os
import six
source = AjaxDataSource(
data_url='http://54.80.255.253:5000/subsample/0/180/0/360/350/800/0',
@kevincolten
kevincolten / merge_weekly_monthy.py
Last active August 29, 2015 14:23
Download Google Trends
import csv
from collections import deque
with open('weekly_stock_trends.csv', 'rb') as f:
reader = csv.reader(f)
weekly_trends = list(reader)
headers = weekly_trends.pop(0)
new_headers = []
@kevincolten
kevincolten / sparkMySQL.scala
Created June 7, 2015 20:07
Import MySQL into Spark
SPARK_CLASSPATH=../mysql-connector-java-5.1.35/mysql-connector-java-5.1.35-bin.jar bin/spark-shell
val jdbcDF = sqlContext.load("jdbc", Map(
"url" -> "jdbc:mysql://localhost:8889/employees?user=root&password=root",
"dbtable" -> "(SELECT employees.*, departments.*, salaries.salary, titles.title FROM employees JOIN dept_emp ON dept_emp.emp_no = employees.emp_no JOIN departments ON departments.dept_no = dept_emp.dept_no JOIN dept_manager ON dept_manager.emp_no = employees.emp_no JOIN salaries ON salaries.emp_no = employees.emp_no JOIN titles ON employees.emp_no = titles.emp_no) AS employees",
"driver" -> "com.mysql.jdbc.Driver",
"partitionColumn" -> "emp_no",
"lowerBound" -> "10001",
"upperBound" -> "499999",
"numPartitions" -> "10"
@kevincolten
kevincolten / phpcs-newer.sh
Created January 27, 2015 22:16
Run PHP_CodeSniffer on files with uncommitted changes
if [ "$(git diff --name-only master --diff-filter=AMR | grep -Ei "^.*app\/(models|controllers)\/.*\.php$")" ]; then vendor/bin/phpcs $(git diff --name-only master --diff-filter=AMR | grep -Ei "^.*app\/(models|controllers)\/.*\.php$") --standard=PSR2; fi
@kevincolten
kevincolten / setup.sh
Last active August 29, 2015 14:07
When Setting Up a New Mac
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update homebrew recipes
brew update