Skip to content

Instantly share code, notes, and snippets.

View daspecster's full-sized avatar
🏠
Working remote

Thomas Schultz daspecster

🏠
Working remote
View GitHub Profile
@daspecster
daspecster / python bayes_on_redis
Created May 17, 2012 01:19
Start of bayes_on_redis implementation
import bayes
import sqlite3
bor = bayes.BayesOnRedis(redis_host='localhost', redis_port=6379, redis_db=0)
conn = sqlite3.connect("connotation.db")
c = conn.cursor()
for row in c.execute('''SELECT * FROM source_data'''):
#print "Training..." + row[2]

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

@daspecster
daspecster / gist:9283442
Created March 1, 2014 01:31
Sublime Prefs
{
"color_scheme": "Packages/Ciapre Color Scheme/CiapreBlack.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_size": 19.0,
"ignored_packages":
[
"JSLint",
"Vintage",
"BracketHighlighter"
@daspecster
daspecster / ziptastic-form.html
Last active August 29, 2015 13:57
Ziptastic Form Example
<form id="theform" class="pure-form pure-form-stacked">
<fieldset>
<label for="name">
Name:
<input type="text" id="name" placeholder="Full Name"/>
</label>
<label for="address1">
Address:
<input type="text" id="address" placeholder="House Number, Street" />
</label>
@daspecster
daspecster / update-python-ec2.sh
Last active March 22, 2016 06:27
Update EC2 Python virtualenv
# Thanks to Sebastian Kreutzberger
# Source: http://www.lecloud.net/post/61401763496/install-update-to-python-2-7-and-latest-pip-on-ec2
# install build tools
sudo yum install make automake gcc gcc-c++ kernel-devel git-core -y
# install python 2.7 and change default python symlink
sudo yum install python27-devel -y
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python
@daspecster
daspecster / Code-Standards.md
Last active August 29, 2015 14:05
Code Standards and Resources
@daspecster
daspecster / postgres-backup.txt
Last active May 17, 2017 23:03
Postgres Backup
Backup and restore databases
# Backup
pg_dump -h <orig db> -U <user> -Fc > data.backup
psql in to db...
$ drop schema public cascade;
$ \connect postgres
$ drop database <dbname>;
@daspecster
daspecster / gist:6111937171e0f83c1391
Created February 25, 2015 19:10
GetZiptastic.com Version 3 jQuery example
$.ajax({
type: "GET",
beforeSend: function(request) {
request.setRequestHeader("x-referrer", "<your domain here. example.com>");
request.setRequestHeader("x-key", "<your api key here>");
},
url: "https://zip.getziptastic.com/v3/US/48867",
success: function(data) {
console.log(data);
}
@daspecster
daspecster / Availability-Indicator.markdown
Last active August 29, 2015 14:16
Availability Indicator

Availability Indicator

This is a simple way to indicate the best times for a client to contact you via a given medium. This could be used for chat, twitter, skype etc...

TODO: Add in timezone support.

A Pen by Thomas Schultz on CodePen.

License.

@daspecster
daspecster / page.html
Last active August 29, 2015 14:16
PHP Ziptastic multi-step form example page 1
<html>
<body>
<form action="/next_page.php" method="get">
Postal Code: <input type="text" name="postalcode">
<input type="submit">
</form>
</body>
</html>