Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh [email protected]
Add ssh fingerprint and enter password provided in email
# Model: | |
def create_business_customer(data) | |
customer = Balanced::Customer.new( | |
address: { | |
line1: data[:address], | |
city: data[:city], | |
state: data[:state], | |
postal_code: data[:state] | |
}, |
def sticker_image_path | |
src = "data:image/png;base64," | |
src += ActiveSupport::Base64.encode64(File.read("#{Rails.root}/app/assets/images/courses/#{self.slug}-sticker.png")) | |
src | |
end |
<div class="row"> | |
<div class="large-12 columns calendar-container"> | |
<h3 class="month"> | |
<a href="/admin/analytics?class=cal-larr&date=2013-11-01"><</a> | |
December 2013 | |
<a href="/admin/analytics?class=cal-rarr&date=2014-01-01">></a> | |
</h3> | |
<section class="calendar" role="main"> | |
<ul class="day-row"> | |
<li class="day">SUN</li> |
.month { | |
font-family: 'ProximaCond'; | |
background: $primary-color; | |
font-size: 28px; | |
letter-spacing: 2px; | |
text-align: center; | |
padding: 10px 0; | |
margin-bottom: 0; | |
color: #fff; | |
a { |
module CalendarHelper | |
def calendar(date = Date.today, &block) | |
Calendar.new(self, date, block).table | |
end | |
class Calendar < Struct.new(:view, :date, :callback) | |
HEADER = %w[SUN MON TUE WED THU FRI SAT] | |
START_DAY = :sunday | |
delegate :content_tag, to: :view |
var PurdyPercent = function (num, options) { | |
this.settings = { | |
hide_decimal_on_whole : true, | |
decimals : 2, | |
truncate : false, // (soon) | |
match_decimals: true, // forces floats to match defined decimal count | |
rounding : 'default', //default, up, down (soon) | |
postfix : '%' | |
}; |
require 'will_paginate/view_helpers/link_renderer' | |
require 'will_paginate/view_helpers/action_view' | |
module WillPaginate | |
module ActionView | |
def will_paginate(collection = nil, options = {}) | |
options[:renderer] ||= FoundationLinkRenderer | |
super.try :html_safe | |
end |
Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh [email protected]
Add ssh fingerprint and enter password provided in email
How would I go about mapping an array of hashes that are nested inside of an array??? I need to get an array returned for each :hours for each month, so I can then use the median method and get an average for each month. I can do it in the views, but using
<% @sleep_months.each do |month, sleep| %>
<ul><%= month.strftime("%B") %>
<% for sleeps in sleep %>
<li><%= sleeps.hours %></li>
<% end %>
</ul>
<% end %>
def index | |
# Sleep.all for current_user | |
@sleeps = current_user.sleeps | |
# Sleep grouped and sorted in order by month | |
@sleep_months = @sleeps.group_by { |s| s.beginning_of_month }.sort { |a,b| a[0] <=> b[0] } | |
@array_for_average_sleep_months = @sleep_months.map { |month, sleep| month.strftime("%b") } | |
@array_for_hours_slept_per_month = ????? |