Skip to content

Instantly share code, notes, and snippets.

@nbashaw
nbashaw / sorryWereClosed.html
Created June 28, 2012 17:29
Hides Olark before 8am and after 5pm Pacific time
<script>
// Hide Olark before 8am and after 5pm Pacific time
var d = new Date();
var utcHour = d.getUTCHours();
var pacificHour = utcHour - 7;
if (pacificHour < 8 || pacificHour > 16) {
olark('api.box.hide');
}
</script>
// Hide Olark before 8am and after 5pm
// (Pacific Time Zone)
var d = new Date();
var utcHour = d.getUTCHours();
var pacificHour = utcHour + 7
if (pacificHour < 8 || pacificHour > 16) {
olark('api.box.hide');
}
To show only parts of the pre-chat survey (or to make some of them required), use the model below, changing the numeric parameter and text parameter as appropriate:
<!-- 2 == required, 1 == show -->
<script type='text/javascript'>
olark.configure('system.require_name', 2);
olark.configure('system.require_email', 0);
olark.configure('system.require_phone', 0);
olark.configure('system.habla_offline_phone_text','\u003Cclick here\u003E and type your Phone Number');
olark.configure('system.start_hidden', true);
window.setTimeout(function() {
olark('api.box.show')
},5000);

Enough To Be Dangerous

Learn enough code to build a crappy prototype of your idea in a week.

Preface

Two years ago, I became obsessed with startups. I was in school at the time, and constantly had a notebook out sketching my web-app ideas. It was entertaining at first, but soon I realized that in order to make progress I had to build the damn things and put them in front of users. So I did what most people do in that situation - began looking for a technical cofounder. I started trying to meet as many programmers as possible.

I got lucky and met a hacker that liked my idea, so we started working together and he suggested I code the HTML and CSS for the front-end of our rails app (it was to be a publishing platform for authors). I resisted at first but quickly realized that I'd lose all credibility if I was unwilling to dabble in a little simple code. So I went through some tutorials and found that coding actually wasn't too hard. Every time I reached an obstacle, an hour or two of googling usually yiel

>> User.find_by_nickname('cwhitaker').calc_scoreMainstream: audioslave - 1.9230769230769231Unknown: cage the elephantHipster: chiddy bang + 1.9230769230769231
Hipster: girl talk + 1.9230769230769231
Hipster: helmet + 1.9230769230769231
Mainstream: incubus - 1.9230769230769231
Unknown: stone temple pilots
Unknown: 311
Unknown: 40 below summer
Unknown: tide down
Hipster: soundgarden + 1.9230769230769231
Unknown: a perfect circle
>> User.find_by_nickname('bean').calc_score
Mainstream: third eye blind - 2.9411764705882355
Mainstream: eminem - 2.9411764705882355
Unknown: rebelution
Hipster: the beatles + 2.9411764705882355
Unknown: lotus
Unknown: the dangerous summer
Unknown: city and colour
Unknown: the spill canvas
Hipster: death cab for cutie + 2.9411764705882355
<!-- this is wrong -->
<head>
<body>
<h1> <p> This is the first paragraph in large text, ever</p></h1>
</body>
</head>
→How long should it take for you to get data from me after I have everything all set up?
Jeremy Linden: hi
Jeremy Linden: you should see data pretty much immediately
→hmmm then I must not be setting this up right - I'm trying to do a little testing to see how a/b tests work in mixpanel
Jeremy Linden: what you would do is set a super property A or B
Jeremy Linden: then that user is tied to that cohort
→as explained in this blog post? http://blog.mixpanel.com/ab-test
Jeremy Linden: no, that is obsolete actually
Jeremy Linden: should probably remove it
Jeremy Linden: it's more simple than that really