Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width" />
<meta charset="utf-8">
<style type="text/css">
/* based on: http://zurb.com/playground/responsive-email-templates */
/* -------------------------------------
GLOBAL
<p id="welcome">
  Welcome to ChallengePost
</p>

When the page loads, you have the above markup. Without reloading the page, you want to add the user's full name in the message so it reads "Welcome to ChallengePost John Doe!"

An ajax request to /users/me.json will return information about the current user in a JSON format that looks like this:

SoftwareMember.where(state: [nil, 'none'])
#=> SoftwareMember Load (1.9ms) SELECT `software_members`.* FROM `software_members` WHERE ((`software_members`.`state` = 'none' OR `software_members`.`state` IS NULL))
SoftwareMember.where(state: [nil, 'none'])
#=> SoftwareMember Load (1.9ms) SELECT `software_members`.* FROM `software_members` WHERE ((`software_members`.`state` = 'none' OR `software_members`.`state` IS NULL))
SoftwareMember.where(state: [nil, 'none'])
#=> SoftwareMember Load (1.9ms) SELECT `software_members`.* FROM `software_members` WHERE ((`software_members`.`state` = 'none' OR `software_members`.`state` IS NULL))
=> md5 = Digest::MD5.new
=> #<Digest::MD5: d41d8cd98f00b204e9800998ecf8427e>
=> md5.file('/web/platform/public/assets/reimagine2-ce3359ec926154355c4c21fcb4a3c765.css')
=> #<Digest::MD5: 4f79c9dc49064c81978a08688dd385dd>
[30] pry(main)> md5.file('/web/platform/public/assets/reimagine2-ce3359ec926154355c4c21fcb4a3c765.css')
=> #<Digest::MD5: e77ad5caafaebff84d5d4e1669b2cd09>
[31] pry(main)> md5.file('/web/platform/public/assets/reimagine2-ce3359ec926154355c4c21fcb4a3c765.css')
=> #<Digest::MD5: bec08de9a3ea401b956f38b90c4e622d>
chrome.app.runtime.onLaunched.addListener(function () {
chrome.app.window.create('window.html', {
bounds: {
width: 400,
height: 500
}
});
});
  1. User starts software flow (cio.track('started_software_flow'))
  2. User does not finish software flow
  3. User starts another software flow (cio.track('started_software_flow'))
  4. User finishes the second software flow (cio.track('finished_software_flow'))

I want to be able to email that user about the first software flow they did not finish.

def featured_portfolios_in_order
ids = Settings.featured_portfolios.keys
users = User.where(id: ids)
users.sort { |a, b| ids.index(a.id) <=> ids.index(b.id) }
end
mysql> select 'Krąków, Poland';
+------------------+
| Krąków, Poland |
+------------------+
| Krąków, Poland |
+------------------+
mysql> select binary 'Krąków, Poland';
+---------------------------+
| binary 'Krąków, Poland' |