Skip to content

Instantly share code, notes, and snippets.

View cstump's full-sized avatar

Chris Stump cstump

View GitHub Profile
#!/usr/bin/env ruby
require 'ap'
require 'pry'
require 'platform-api'
token = 'c' # Create token as seen at https://github.com/heroku/platform-api#a-real-world-example
heroku = PlatformAPI.connect_oauth(token)
apps = heroku.app.list
app_names = apps.map { |app| app['name'] unless app['name'].include?('-pr-') }.compact
@cstump
cstump / lightning.rb
Last active December 9, 2015 19:21
Centro lightning talk on different ways to use Ruby modules
module Alcoholic
def abv
4.2
end
end
class Lager
include Alcoholic
end
@cstump
cstump / palindrome_finder.rb
Last active August 29, 2015 14:25
Find the longest palindrome in a string
#
# Finds the longest palindrome in a string
# Works for palindromes of both even and odd length
# Has O(n^2) runtime, which is not the fastest
# Manacher's algorithm promises O(n) time
#
# Odd length example: "ABCBAHELLOHOWRACECARAREYOUILOVEUEVOLIIAMAIDOINGGOOD"
# Result: 'ILOVEUEVOLI'
#
# Even length example: "forgeeksskeegfor"
source 'https://rubygems.org'
# core
gem 'rails', '3.2.16'
gem 'mysql2', '0.3.10'
# models
gem 'kaminari', '0.13.0'
# views
require 'active_support'
module TestConcern
extend ActiveSupport::Concern
module ClassMethods
def test_class_method
puts "I gots class!"
end
end