Skip to content

Instantly share code, notes, and snippets.

@bxh-io
bxh-io / elevator3.py
Last active October 29, 2022 20:32 — forked from elliotchance/elevator.py
The Elevator Game
import random
import time
class Person:
WAITING = 0
IN_ELEVATOR = 1
DONE = 2
def __init__(self, from_floor, to_floor):
self.from_floor = from_floor
<script>
lp.jQuery(function($) {
var ruleID = 'notWebmail';
var field = 'email';
var message = 'Please enter your work mail address.';
var rules = module.lp.form.data.validationRules[field];
class LessonCheckMixin(object):
def __init__(self):
# List of method names on mixin
#
self._LESSON_CHECK_METHODS = ['expected_failure', 'companies_check']
def can_see_lessons(self, *args, **kwargs):
"""
"""
for AUTHORIZATION_CHECK in self._LESSON_CHECK_METHODS:
User Onboarding
User onboarding is the process of increasing the likelihood that new users become successful when adopting your product. You need to balance the user experience of onboarding with the friction of necessary steps such as account creation, user education, and data gathering.
Definition of Success
A successful onboarding process can be defined as making the user successful not only within the scope of using your product but in whatever grander mission you have promised.
Sections:
Pre Onboarding
$('.selector').each(function(){
var $this = $(this);
var $text = $this.text();
if($text.length > 10){
$this.text($text.substring(0, 10-3) + "...");
}
});
App.utility.prettyTime = function(){
//The *1000 here is because python UTC is different in seconds compared to JS UTC in milliseconds
//The this here is normally the function that calls this, but watch out what calls this function
function plural_time(n, period) {
if (n < 2) {
return "1 " + period + " ago";
}
else {
return n + " " + period + "s ago";
<div class="answer-meta">
{{#if isGlobalQuestion}}
<p>You are viewing a global question</p>
{{else}}
{{#if content.is_followed}}
<a {{action followQuestion}}class="follow unfollow"><span class="ss-icon">&#xEB85;
</span>Following</a>
{{else}}
<a {{action followQuestion}}class="follow"><span class="ss-icon">&#xEB85;
</span>Follow</a>
{{#if isGlobalQuestion}}
{{#if content.global_answers.length}}
<a class="global-answers selected">{{content.number_of_community_answers}}</a>
{{else}}
No Community Answers
{{/if}}
{{else}}
{{#if content.global_answers.length}}
{{#if content.number_of_course_answers.length}}
<!-- If there are both course and global answers-->
{{#if isGlobalQuestion}}
{{#if content.global_answers.length}}
<a class="global-answers selected">{{content.number_of_community_answers}}</a>
{{else}}
No Community Answers
{{/if}}
{{else}}
     {{#if content.global_answers.length}}
<a {{action switchAnswers target="parentView"}} {{ bindAttr class=":course-answers notGlobalAnswers:selected" }}>{{content.number_of_course_answers}} <span class="ss-icon">&#xF501;</span></a>
@bxh-io
bxh-io / gist:1211053
Created September 12, 2011 11:25
Convert.sh
#!/bin/bash
ROOTDIR=/Users/ben/Desktop/batch/pdfs
PDFDIR=$ROOTDIR/pdfs
PY_SCRIPT_DIR=$ROOTDIR
PAGESFILE=$ROOTDIR/sage_strim.csv
echo $PAGESFILE