Skip to content

Instantly share code, notes, and snippets.

View growing-chart-bar-chart.js
chart = new GrowingCharts(document.getElementById('bar-chart'))
chart.render({
type: "barChart",
chartSize: {
marginLeft: 50,
marginRight: 50,
width: 600,
height: 500
},
View growing-chart-area-chart.js
chart = new GrowingCharts(document.getElementById('area-chart'))
chart.render({
type: "areaChart",
chartSize: {
marginLeft: 50,
marginRight: 50,
width: 600,
height: 500
},
View growing-chart-waterfall-chart.js
chart = new GrowingCharts(document.getElementById('waterfall-chart'))
chart.render({
type: "waterFall",
chartSize: {
marginLeft: 50,
marginRight: 50,
width: 600,
height: 500
},
View growing-chart-line-chart.js
chart = new GrowingCharts(document.getElementById('line-chart'))
chart.render({
type: "lineChart",
chartSize: {
marginLeft: 50,
marginRight: 50,
},
data: [{x: "2015-01-01", y: 1}, {x: "2015-01-02", y: 1.3}, {x: "2015-01-03", y: 2.5}, {x: "2015-01-04", y: 2.9}, {x: "2015-01-05", y: 3.2}, {x: "2015-01-06", y: 3.8}, {x: "2015-01-07", y: 4}, {x: "2015-01-08", y: 4.9}, {x: "2015-01-09", y: 5.5}, {x: "2015-01-10", y: 5.8}, {x: "2015-01-11", y: 6.2}, {x: "2015-01-12", y: 6.8}, {x: "2015-01-13", y: 7.2}, {x: "2015-01-14", y: 8}, {x: "2015-01-15", y: 8.9}, {x: "2015-01-16", y: 9.2}, {x: "2015-01-17", y: 8.7}, {x: "2015-01-18", y: 8.1}, {x: "2015-01-19", y: 7.2}, {x: "2015-01-20", y: 6.6}, {x: "2015-01-21", y: 5.9}, {x: "2015-01-22", y: 5.2}, {x: "2015-01-23", y: 4.6}, {x: "2015-01-24", y: 3.5}, {x: "2015-01-25", y: 2.9}, {x: "2015-01-26", y: 2.1}, {x: "2015-01-27", y: 1.3}, {x: "2015-01-28", y: 1.8}, {x: "2015-01-29", y: 1.6}, {x: "2015-01-30", y: 1.1}, {x: "2015-01-31", y: 1.8}],
xAxis: {
View bounced_mails_controller.rb
class Api::BouncedMailsController < ApplicationController
skip_before_filter :verify_authenticity_token
def create
if verify(ENV["mailgun_api_key"], params[:token], params[:timestamp], params[:signature])
user = User.find_by_email(params[:recipient])
if user && params[:event] == "bounced"
user.lock!
end
head(200)
View Building_a_data-driven_approach_to_keeping_user_contacts_up-to-date.md

Building a data-driven approach to keeping user contacts up-to-date

This blog was written by Roy Young. Roy is a student from Tealeaf Academy.

Do you remember every email address you use with every one of your online accounts? You know, the accounts you use with your spam email address, versus your "real" email, versus your work email? Probably not. And neither do your users. That is why it makes sense to periodically confirm that you have the best contact information on file for your customers. You could do this every month, or once a year, or take a data driven approach that lets you focus only on the customers that will most likely find your notices to update their contact information helpful, rather than annoying.

Application logic for prompting user to update their email address

When you send email to an email address that no longer exists, the receiving party (e.g. Gmail or Yahoo) will bounce the email back to you. If you listen to t

View gist:6313209

#Discovering Better Object Oriented Design with tests

In the zirannanren app, From begging, We just provided one type of courses. We record Videos and share them to our members.

In our videos#index we did this:

class VideosController < ApplicationController
  def index
    @videos = Video.all
View gist:6932662

The use case:

  • When a new ticket in one project was created, all the users of this project will receive a notify email whose address is "ticket+PROJECT_UID+TICKET_UID@info.pragmatic.ly"

  • When a new iteration in one project was created, all the users of this project will receive a notify email whose address is "iteration+PROJECT_UID+TICKET_UID@info.pragmatic.ly"

  • We use SendCloud mail server, when it received an email replied by user, it will post the json data to the app route "/api/email_replies", we had defined in SendCloud.

  • When the app received the post request, first, it needs to verify that the request is posted from SendCloud. We get the authentication strategy from SendCloud Api.