Skip to content

Instantly share code, notes, and snippets.

/*jshint multistr:true */
var text = "blah blah Benjamin blah blah blah Benjamin";
var myName = "Benjamin";
var hits = [];
for (var i=0; i < text.length; i++) {
if (text[i] === myName[0]) {
for(j = i; j < i + myName.length; j++) {
if(text[j]===myName[j-i]) {
@attatae
attatae / gist:b6e5632a2e773c8d7ec7
Last active August 29, 2015 14:03
Error push Heroku
Please see if you can push the current repo. I have tried rake precompile:assets and it did not fix the error
Git status says current with master
***
Error during push:Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
@attatae
attatae / new.html.erb
Created April 19, 2014 17:50
devise registration new
<h2>Sign Up</h2><hr/>
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<p><%= f.input :first_name %></p>
<p><%= f.input :last_name %></p>
<p><%= f.input :profile_name %></p>
<p><%= f.input :email %></p>
<p><%= f.input :email %></p>
@attatae
attatae / _form.html.erb
Created April 18, 2014 18:13
and_sil _form
<%= form_for @event do |f| %>
<% if @event.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@event.errors.count, "error") %> prohibited
this post from being saved:</h2>
<ul>
<% @event.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<div class="page-header">
<h1>All Events</h1>
</div>
<%= link_to 'New Event', new_event_path, class: "btn btn-primary" %>
<div id="post-btn-margin">
</div>
<% @events.each do |event| %>
<div class="event">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../assets/ico/favicon.ico">
<!DOCTYPE html>
<html>
<head>
<title>Network</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
</head>
@attatae
attatae / gist:10436529
Created April 11, 2014 01:41
profiles controller snippet.rb
def index
if params[:interest]
@profiles = Profile.tagged_with(params[:interest], :on => :interests)
else
@profiles = Profile.all
end
if params[:skill]
@profiles = Profile.tagged_with(params[:skill], :on => :skills)
else
class Profile < ActiveRecord::Base
acts_as_taggable_on :interests, :skills
end
Network::Application.routes.draw do
resources :profiles do
end
get "profiles/show"
devise_for :users, :controllers => {:registrations => "users/registrations"}
get 'tags/:tag', to: 'events#index', as: :tag
get 'interests/:interest', to: 'profiles#index', as: :interest
get 'skills/:skill', to: 'profiles#index', as: :skill