This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.openstreetmap.org/export/embed.html?bbox=11.96583867073059%2C57.68774908130971%2C11.977425813674927%2C57.692273648867435&layer=hot" style="border: 1px solid black"></iframe><br/><small><a href="http://www.openstreetmap.org/#map=17/57.69001/11.97163&layers=H">Visa större karta</a></small> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require 'io/console' | |
def parse_csv(file) | |
@emails = [] | |
CSV.foreach(file, headers: true, header_converters: :symbol, converters: :all) do |row| | |
@emails << row[:email] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'google/api_client' | |
class YouTube | |
DEVELOPER_KEY = ENV['YOUTUBE_KEY'] || 'YOU API KEY' | |
YOUTUBE_API_SERVICE_NAME = 'youtube' | |
YOUTUBE_API_VERSION = 'v3' | |
def initialize(query, count) | |
@query = query | |
@count = count.to_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
def total_time(minutes) | |
seconds_diff = minutes*60 | |
days = seconds_diff / 86400 | |
seconds_diff -= days * 86400 | |
hours = seconds_diff / 3600 | |
seconds_diff -= hours * 3600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
class CsvExport | |
def initialize(collection, attributes=[]) | |
@collection, @attributes = collection, attributes | |
end | |
def generate | |
CSV.generate do |csv| | |
csv << attributes.map(&:to_s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe EventHelper do | |
it 'cover_for PairProgramming' do | |
event = mock_model(Event, category: 'PairProgramming') | |
result = helper.cover_for(event) | |
expect(result).to match /event-pairwithme-cover\.png/ | |
end | |
it 'cover_for Scrum' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldset class="event_option" id="repeats_monthly_options"> | |
<%= f.number_field :repeats_every_n_months %> | |
<%= f.select :repeats_monthly, Event::RepeatMonthlyOptions %> | |
<div class="control-group" id="event_repeats_monthly_each"> | |
<label class="control-label">Each</label> | |
<div class="controls"> | |
<% Event::DaysOfTheMonth.each do |day_of_the_month| %> | |
<%= label_tag "event_repeats_monthly_each_days_of_the_month_#{day_of_the_month}", day_of_the_month, :class => 'checkbox inline' do %> | |
<%= check_box_tag "event[repeats_monthly_each_days_of_the_month][#{day_of_the_month}]", day_of_the_month, f.object.repeats_monthly_each_days_of_the_month.include?(day_of_the_month), {:name => "event[repeats_monthly_each_days_of_the_month][]"} %> | |
<%= day_of_the_month %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Methods for legacy password handling with Devise | |
def valid_password?(password) | |
if has_legacy_password? | |
return false unless valid_legacy_password?(password) | |
convert_legacy_password!(password) | |
true | |
else | |
super(password) | |
end | |
end |