Skip to content

Instantly share code, notes, and snippets.

View raderj89's full-sized avatar

Jared Rader raderj89

View GitHub Profile
class Shape
attr_accessor :color
def can_fit?(shape)
area > shape.area
end
end
class Rectangle < Shape
attr_accessor :width, :height
@raderj89
raderj89 / _posts.html.erb
Last active December 28, 2015 05:19
Trying to implement infinite scroll on Bloccit.
<% @posts.each do |post| %>
<div class="media">
<%= render partial: 'votes/voter', locals: { topic: @topic, post: post } %>
<div class="media-body">
<h4 class="media-heading">
<%= link_to (markdown post.title), [@topic, post] %>
<%= image_tag(post.image.thumb.url) if post.image? %>
<br>
<small>
<%= image_tag(post.user.avatar.tiny.url) if post.user.avatar? %>
@raderj89
raderj89 / add_or_remove.html.erb
Last active December 30, 2015 02:39
add and remove collaborators solution
<!-- wiki_collaborations/add_or_remove.html.erb -->
<!-- how can this be cleaned up? -->
<div class="row">
<div class="col-sm-6">
<%= form_for wiki, url: wiki_collaborations_path, method: :post do %>
<%= hidden_field_tag :wiki_id, wiki.id %>
<% @users.each do |user| %>
<% next if current_user == user %>
<div class="checkbox">
@raderj89
raderj89 / new.html.erb
Last active December 30, 2015 07:59
my horrible awful subscription solution
<h1>Select a plan</h1>
<div class="row">
<%= form_for @subscription, url: user_subscriptions_path, method: :post, html: { class: 'form-horizontal' } do %>
<div class="col-sm-4">
<%= hidden_field_tag :stripe_card_token %>
<div class="form-group">
<%= label_tag "Premium" %>
@raderj89
raderj89 / home.html.erb
Last active December 30, 2015 17:48
my horrible awful stripe/signup integration
<div class="jumbotron center">
<h1 class="center-header">Blocipedia</h1>
<h2 class="center-header">Social, Markdown Wikis</h2>
<br>
<div class="row">
<div class="col-sm-5">
<h3>Free Account</h3>
<ul>
<li>Create unlimited public wikis</li>
<li>Collaborate with unlimited users</li>
@raderj89
raderj89 / markdown_preview.js
Created December 9, 2013 02:55
markdown preview
(function( $ ){
$.fn.markdownPreview = function() {
return this.each(function() {
var $this = $(this);
$this.wrap( '<div class="markdown_wrap editing"></div>' );
@raderj89
raderj89 / edit.html.erb
Last active December 31, 2015 12:29
trying to get account upgrades working
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<h1>Edit <%= resource_name.to_s.humanize %></h1>
</div>
Current account: <%= resource.plan.name %>
</div>
<div class="panel-body">
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
class BoggleBoard
#your code here
end
dice_grid = [["b", "r", "a", "e"],
["i", "o", "d", "t"],
["e", "c", "l", "r"],
@raderj89
raderj89 / index.html.erb
Last active August 29, 2015 13:55
various bootstrap divs
<div class="row">
<div class="col-md-6">
<h1>Refcodes</h1>
Referral discounts for great tech<br>
products and services
</div>
<div class="col-sm-6 message">
Share referral discounts for your favorite web products and services, and redeem discounts for other products and services you want to try out. Oh, and if you see that there is already a post for the same referral deal, don't duplicate it. Otherwise, we might remove it.
<br>
<span class="pull-right">Thanks!</span>
@raderj89
raderj89 / boggle_class.rb
Last active August 29, 2015 13:55 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
boggle class challenge
class BoggleBoard
def initialize(dice_grid)
@dice_grid = dice_grid
end
def create_word(*coords)
coords.map { |coord| @dice_grid[coord.first][coord.last] }.join("")
end
def get_row(row)