Skip to content

Instantly share code, notes, and snippets.

$(document).ready(function() {
// create new grid object based on size[[x,x], [x,x]]
var grid = new Grid(5).init();
// set top left (first element of first array) to be full
grid[0][0].value = 1;
// build the dom
grid.forEach(function(row, i) {
$("#grid").append("<div class='row row-" + i + "'></div>");
row.forEach(function(spot){
if (spot.value === 1) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<table>
<thead>
<tr>
source "https://rubygems.org"
gem 'faraday'
gem 'rspec'
<section>
<section class="half green-light left" id="speaker-photo">
<div class="spkr-prev left"><a id="prev2" href="">button</a></div>
<div class="spkr-middle left">
<div class="spkr-cir" style="background-image: url(<?php echo $url ?>); ?>/img/tester.jpg)"></div>
<div class="speaker-name"><?php echo '<h2>' . get_the_title() . '</h2>'; ?></div>
</div>
<div class="spkr-next left"><a id="next2" href="">button</a></div>
<br style="clear: left">
</section>
/* Top menu items */
.nav-bar ul {
margin:0;
padding:0;
list-style:none;
/*float:right;*/
position:relative;
/*right:50%;*/
$('#hide1').hide();
$("input:checkbox[value='The legal representative for the patient']").change(function(){
$('#hide1').toggle();
});
test_str = "Doo bee doo bee doo"
counted = Hash[test_str.downcase.split.map { |p| [p, 0] }]
#=> {"doo"=>0, "bee"=>0}
Desired output (counting number of times a word appears in a string, returned inside of a hash)
#=> {'doo' => 3, 'bee' => 2}
Greenu::Application.routes.draw do
get "/markets" => "markets#index", :as => "markets"
get "/market/new" => "markets#new", :as => "new_market"
get "/market/:id" => "markets#show", :as => "market"
post "/markets" => "markets#create"
<!-- will be put into helper and need to DRY-->
<% d = Date.today %>
<% today = d.wday %>
<% if today == 1 %>
<% today = "Monday" %>
<% elsif today == 2 %>
<% today = "Tuesday" %>
<% elsif today == 3 %>
<% today = "Wednesday" %>
<% elsif today == 4 %>
require 'json'
require 'open-uri'
class MarketsController < ApplicationController
def index
@markets = Market.all
end
def show