This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contact < ActiveRecord::Base | |
attr_accessible :email, :name, :track | |
validates :name, :email, :track, presence: true | |
validates :email, uniqueness: true | |
validates :track, inclusion: { in: %w(sales marketing software product) } | |
validates_format_of :email,:with => /^([^\s]+)((?:[-a-z0-9]\.)[a-z]{2,})$/i | |
before_validation :downcase_track |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe Contact do | |
it "should be invalid without a name" do | |
@contact = Contact.new(email: 'foo@foo.com', track: 'product') | |
@contact.should_not be_valid | |
end | |
it "should be invalid without an email" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ian Daniher http://itdaniher.com Nonolith Labs, LLC. | |
Mariah Dunn Microsoft | |
Reyner Crosby http://twitter.com/reyner Twitter | |
Andrew Carmedelle Lab126 (Amazon's Kindle subsidiary) | |
Gracie Sanford Lit Motors | |
Eric Schneider Harvest Automation | |
Kelsey Breseman http://www.instructables.com/member/SelkeyMoonbeam/ Instructables.com | |
Hannah Sarver litl | |
Tim Cameron Ryan https://github.com/timcameronryan Game Closure | |
Ariana Chae Alleyoop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MongoDB | |
var persistentDB = null; | |
function openDatabase(fn) { | |
if(persistentDB == null) { | |
db_connection.open(function(err,db) { | |
persistentDB = db; | |
fn(err,persistentDB); | |
}) | |
} else { | |
fn(null, persistentDB); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server | |
var io = require('socket.io').listen(app) | |
io.of('/chat').on('connection', function (sockets) { | |
// do some stuff | |
}); | |
// client | |
var chat = io.connect('http://localhost/chat') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# this requires the nokogiri and mail gems | |
# this requires a sendgrid account, since you don't want to deal | |
# with setting up smtp delivery on your own machine | |
# sendgrid gives you 200 emails/day free | |
# | |
# 1. export from readitlater | |
# 2. separate the Unread and Archive sections (this doesn't distinguish URLs) | |
# 3. configure SMTP and email destination | |
# 4. go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum groupinstall 'Development Tools' | |
yum install openssl-devel | |
git clone https://github.com/joyent/node.git | |
cd node | |
git checkout v0.6.11 | |
./configure | |
make | |
make test | |
make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# super annoying, no locales installed by default | |
dpkg-reconfigure locales | |
# build essential for eventually building some native libs | |
aptitude install build-essential | |
# some basics | |
aptitude install tmux git curl ca-certificates openssl libssl-dev redis-server python-minimal | |
# build node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html manifest='/cache/manifest'> | |
<head> | |
<link href='https://si0.twimg.com/twitter-mobile/76a2baaafd4af4df43c34a9ef8a2e566362cc9ab/images/apple-touch-icon-114.png' rel='apple-touch-icon-precomposed' /> | |
<link href='https://si0.twimg.com/twitter-mobile/76a2baaafd4af4df43c34a9ef8a2e566362cc9ab/images/ic_favicon.png' rel='icon' type='image/png' /> | |
<title> | |
</title> | |
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' id='viewport' name='viewport' /> | |
<script type='text/javascript'> | |
//<![CDATA[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void shareArticle() { | |
Map<String, String> values = new HashMap<String, String>(); | |
values.put(TITLE, articleTitle); | |
values.put(URL, articleUrl); | |
this.localyticsSession.tagEvent(SHARE_EVENT, values); | |
StringBuilder shareTextBuilder = new StringBuilder(); | |
shareTextBuilder.append("I'm currently reading \""); |
NewerOlder