This was my trip to the market this morning. Every Friday we have a local market in the neighborhood. These happen everyday in multiple places every week. This was about 3 blocks from our place. Chilean peso has recently weakened in value!!! Good for me, it is now 640~ pesos to $1 USD, about 25 pesos more than in Dec. To convert price CLP/KILO to USD/LB divide CLP/1405. All of this is local, but not organic. Its only what is in season, so every couple of weeks it changes pretty drastically.
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
{"_id"=>nil, "total_plays"=>486721} | |
{"_id"=>"(Various Artists) ", "total_plays"=>5858} | |
{"_id"=>"Radiohead", "total_plays"=>5181} | |
{"_id"=>"Beck", "total_plays"=>3713} | |
{"_id"=>"Built to Spill", "total_plays"=>3439} | |
{"_id"=>"Pixies", "total_plays"=>3404} | |
{"_id"=>"Modest Mouse", "total_plays"=>3173} | |
{"_id"=>"Arcade Fire", "total_plays"=>3130} | |
{"_id"=>"Death Cab for Cutie", "total_plays"=>3033} | |
{"_id"=>"Wilco", "total_plays"=>3019} |
#Setup new rails project with minitest and capybara for Behaviour Driven Development Introduction to Minitest.... We'll be setting up a new rails app with minitest and capybara so we can go over the steps to getting this going. We'll be using a rails 4.1+ in this example. Lets get started!
First thing create a new rails application, a git repository, and the first commit to the repo.
rails new awesomeapp
cd awesomeapp
git init
git add -A
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
class Event < ActiveRecord::Base | |
#Existing scopes | |
scope :day, lambda {|day| where(" DATE(starts_at) = '#{day}%' | |
OR DATE(ends_at) = '#{day}%' | |
OR DATE('#{day}') BETWEEN DATE(starts_at) AND DATE(ends_at)") } | |
scope :between, lambda {|range_start, range_end| where(" DATE(starts_at) BETWEEN DATE('#{range_start}') AND DATE('#{range_end}') | |
OR DATE(ends_at) BETWEEN DATE('#{range_start}') AND DATE('#{range_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
User.all.includes(:questions).map(&:question_ids).flatten.group_by { |n| n }.map { |k,v| [ k, v.size ] }.sort_by { |a| a.last }.each { |a| max = a.last if a.last > max }.select { |e| e.last == max } | |
User.all.map(&:question_ids).flatten.group_by { |n| n }.map { |k,v| [ k, v.size ] }.sort_by { |a| a.last }.each { |a| max = a.last if a.last > max }.select { |e| e.last == max } |
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 file should contain all the record creation needed to seed the database with its default values. | |
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). | |
# | |
# Examples: | |
# | |
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) | |
# Mayor.create(name: 'Emanuel', city: cities.first) | |
require 'ffaker' | |
def sample_text |
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
<% flashes = {notice: 'success', alert: 'standard', error: 'alert', secondary: 'info'} %> | |
<% flashes.each do |key, value| %> | |
<% if flash[key] %> | |
<%= content_tag :div, :data => { :alert => '' }, :class => "alert-box #{value} radius" do %> | |
<%= flash[key] %> | |
<%= link_to '×'.html_safe, '#', :class => 'close'%> | |
<% end %> | |
<% 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
Attempting to implement a mergesort algorithm, pry exited with the included error message. The corresponding algorithm is attached also. |
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
# .railsrc | |
-B #Skip Bundle | |
-T #Skip Test-Unit | |
-d postgresql #Use postgres |
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
# .railsrc | |
-B #Skip Bundle | |
-T #Skip Test-Unit | |
-d postgresql #Use postgres | |
# template.rb | |
#add guard-minitest and spring to dev | |
gem_group :development do |