Skip to content

Instantly share code, notes, and snippets.

View gangelo's full-sized avatar
:octocat:
Got codez?

Gene M. Angelo, Jr. gangelo

:octocat:
Got codez?
View GitHub Profile
@gangelo
gangelo / link.html.erb
Created April 26, 2013 23:17
jQuery UI Tooltip example. Requires jQuery UI 1.9.2 which includes jQuery Core
@gangelo
gangelo / README
Created July 8, 2014 01:57
Thinkful Wikiful "/signup" postback routes to "/users"
Description:
When signing up as a new user, in "/signup," the "Create User" button will postback to "/users." Not that big a deal, until the submitted form fails validation, in which case the postback url will be "/users." I don't like going to "/signup," only to see "/users" if my form fails validation.
The following is what I did to remedy this, seems simple, but am not sure if there is a "better" way? Suggestions?
@gangelo
gangelo / .bash_profile
Last active August 29, 2015 14:04
Git ~/.bash_profile prompt
# Warning: This is NOT a replacement for your current ~/.bash_profile file. The below script
# is meant to be added to the bottom of your current ~/.bash_profile file.
#
# APPEND (do not replace!) the below script to your current ~/.bash_profile file.
#
#
# Requirements
@gangelo
gangelo / capybara_support.rb
Created September 18, 2014 01:40
How/where to add Capybara feature helper methods to keep your Capybara features (specs) DRY
#
# A DRY Capybara helper method that can be used in multiple Capybara features (specs).
# Place this file in spec/support; the file name can be arbitrary (e.g. you can name your file anything).
module CapybaraHelpers
def sign_up
visit signup_path # '/signup'
within(".form-container") do
fill_in 'Name', with: 'Gene Angelo'
fill_in 'User Name', with: 'gangelo'
fill_in 'Email', with: 'iluv@cake.com'
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@gangelo
gangelo / database_cleaner.rb
Created September 20, 2014 18:41
database_cleaner, rspec-rails and capybara configuration strategy
#
# What's this do?
#
# Keep your test database clean whilst testing, using database_cleaner, rspec-rails and capybara.
#
# Instructions:
#
# Place this file in spec/support
#
# Assumptions:
Flash[:notice] vs. Flash.now[:notice]
============================================
Flash[:notice] - message will persist to the next action and should be used when redirecting to another action via the 'redirect_to' method.
Flash.now[:notice] - message will be displayed in the view your are rendering via the 'render' method.
Log and watch messages logged realtime
============================================
# In my code...
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@gangelo
gangelo / UIDesignableXibExample.swift
Created December 8, 2016 14:12
A designable .xib .swift class example [Swift 3, Xcode 8.1]
//
// UIDesignableXibExample.swift
//
// Created by Gene M. Angelo Jr. on 12/8/16.
// Copyright © 2016 Mohojo Werks LLC. All rights reserved.
//
import UIKit
@IBDesignable class UIDesignableXibExample: UIView {
@gangelo
gangelo / fizz_buzz.rb
Last active December 14, 2022 09:29
fizz buzz
# Fizz buzz
# Range 1 -> 100 (inclusive)
# If divisible by 3, output fizz
# If divisible by 5, output buzz
# If divisible by 3 and 5, output fizzbuzz
FIZZ = 'fizz'.freeze
BUZZ = 'buzz'.freeze
FIZZBUZZ = (FIZZ + BUZZ).freeze