Skip to content

Instantly share code, notes, and snippets.

#! /usr/env/bin/ruby
# Convert a string into an array of arrays with the word and number
# of occurances of that word.
#
# @param [text] : String
# @return [array] : [[word, count], [word2, count2]]
def analyze_paragraph(text)
# we don't need anything except spaces and lower case letters
text = text.to_s.downcase.gsub(/[^0-9A-Za-z\s]/, '')
@alexggordon
alexggordon / test.txt
Created October 16, 2015 20:40
Package Control Channel Test Results
Running Default Channel Tests
Fetching remote repositories:
https://bitbucket.org/jjones028/p4sublime/raw/tip/packages.json ... skipping (schema version 1.2)
https://bitbucket.org/klorenz/sublime_packages/raw/tip/packages.json ... skipping (schema version 2.0)
https://csch1.triangulum.uberspace.de/release/packages.json ... done
https://eberstarkgroup.com/releases/packages.json ... done
https://packagecontrol.io/packages_2.json ... skipping (schema version 2.0)
https://raw.githubusercontent.com/20Tauri/DoxyDoxygen/master/DoxyDoxygen.json ... done
https://raw.githubusercontent.com/accerqueira/sublime/master/packages.json ... skipping (schema version 2.0)
@alexggordon
alexggordon / @farcepestpost.txt
Last active October 14, 2015 00:57
Farpest Post
** Text of the post on Sourceforge by Andy Dustman (@farcepest) for redundancy**
** http://sourceforge.net/p/mysql-python/discussion/70460/thread/9ae42ab5/ **
There have been questions about the license for MySQLdb, so here's my official position.
Originally MySQLdb had a license based on the old Python license, i.e. the CNRI license, which is essentially BSD-ish. Later, because MySQL uses a GPL license, GPL v2 was added. However, it's up to you which license to use on MySQLdb-1.2.
Licensing is not an issue for end-users. The GPL only applies to people who distribute the package. If you just download MySQLdb and use it in your own code, you do not have to accept any license. See section 0 of the GPL. http://www.gnu.org/licenses/gpl-2.0.html
"""Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on th
/usr/bin/clang \
-bundle \
-undefined dynamic_lookup \
-mmacosx-version-min=10.7 \
-L/Users/alexggordon/Documents/mysql-build/osx/py33-x86_64/staging/lib \
-I/Users/alexggordon/Documents/mysql-build/osx/py33-x86_64/staging/include \
-I/Users/alexggordon/Documents/mysql-build/osx/py33-x86_64/staging/include/openssl \
-I/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include /Users/alexggordon/Documents/mysql-build/osx/py33-x86_64/tmp/temp.macosx-10.7-x86_64-3.3/_mysql.o /Users/alexggordon/Documents/mysql-build/osx/py33-x86_64/staging/lib/libmysqld.a \
-L/Users/alexggordon/Documents/mysql-build/osx/py33-x86_64/staging/lib \
-o /Users/alexggordon/Documents/mysql-build/osx/py33-x86_64/tmp/lib.macosx-10.7-x86_64-3.3/_mysql.so \
@alexggordon
alexggordon / compile 1
Created September 23, 2015 15:17
Object Compilation Script
clang \
-DNDEBUG \
-g \
-fwrapv \
-O3 \
-Wall \
-Wstrict-prototypes \
-mmacosx-version-min=10.7 \
-I/Users/alexggordon/Documents/mysql-build/osx/py33-x86_64/staging/include \
-I/Users/alexggordon/Documents/mysql-build/osx/py33-x86_64/staging/include/openssl \
@alexggordon
alexggordon / The Technical Interview Cheat Sheet.md
Last active August 29, 2015 14:28 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
// react code
render() {
let delta = this.props.delta ? (
<strong className={this.props.delta > 0 ? 'text-success' : 'text-danger'}>
{this.props.delta}
</strong>
) : null;
return (
<div className='card'>
@alexggordon
alexggordon / big-query-reddit.sql
Last active August 29, 2015 14:24
Big Query Most Downvoted Reddit Comment
SELECT score,
subreddit,
link_id,
body,
author
FROM [fh-bigquery:reddit_comments.2007],
[fh-bigquery:reddit_comments.2008],
[fh-bigquery:reddit_comments.2009],
[fh-bigquery:reddit_comments.2010],
[fh-bigquery:reddit_comments.2011],
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="crunch"
export VISUAL=/usr/bin/vim
@alexggordon
alexggordon / Big Comment.py
Created April 13, 2015 20:22
A Sublime Plugin for Inserting a Title-Like Sql Comment
import sublime
import sublime_plugin
import time
import threading
class InsertBigCommentCommand(sublime_plugin.TextCommand):
def run(self, args):
thread = BigComment(self.view, args)
thread.start()