Skip to content

Instantly share code, notes, and snippets.

View kibaekr's full-sized avatar

Keith Ryu kibaekr

  • Fountain
  • San Francisco, CA
View GitHub Profile
module Ratis
class RoutePattern
attr_accessor :description, :area, :lat, :long, :point, :atisstopid, :stopid
def self.where(conditions)
#just trying to find by date for now. once this works, will add servicetype condition
date = conditions.delete(:date).to_s.upcase
@kibaekr
kibaekr / user.rb
Last active December 12, 2015 01:39
www
def achievements
achieve = []
admin_for = memberships.where(admin: true)
achieve << 'admin' if admin_for.any?
achieve << 'paid_admin' if admin_for.detect { |m| m.account.invoices.paid.any? }
#achieve << 'www' if domain_includes?("www")
achieve.join(',')
end
<header class="masthead" id="header">
<div class="container">
<div class="row">
<div id="header-img" class="span4 pull-left">
<%= link_to(account_logo(@current_account), root_path) %>
</div>
<% if @is_admin %>
<div class="domain-info span8 offset4 pull-right">
<div class="row">
<%= form_for WatchedDomain.new do |f| %>

Deploy Rails app to digitalocean/amazon EC2 with nginx, unicorn, capistrano, sidekiq & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh -i config/onvard.pem root@54.200.188.117

Add ssh fingerprint and enter password provided in email

config.log_level = :debug
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
@kibaekr
kibaekr / gist:11191069
Created April 22, 2014 19:19
course_spec.rb
it "should be able to be completed if all steps are complete" do
@course.steps.delete_all
step = FactoryGirl.build(:step)
@course.steps << step
@user.steps << step
@course.completed_by(@user).should == true
end
@kibaekr
kibaekr / course show
Created June 12, 2014 03:49
some changes that need to be reflected in merge
<%= content_for :body_id, "sidebar" %>
<div class="menubar">
<div class="sidebar-toggler visible-xs">
<i class="ion-navicon"></i>
</div>
<div class="page-title course_title">
<% if params[:curriculum_id] %>
<% curriculum = @course.curriculums.find(params[:curriculum_id]) %>
<a href="/curriculums/<%= curriculum.id %>" data-toggle="tooltip" data-placement="right" title="Back to <%= curriculum.title unless curriculum.blank? %>"><i class="fa fa-arrow-left margin-right-5"></i> </a>
Kibaeks-MacBook-Pro:onvard_saas kibaek$ rails c
Loading development environment (Rails 3.2.17)
[1] pry(main)> sc = ScormCloud::ScormCloud.new("23Z8XTPJ0Z","xCalRn4voMjyHJGARV2XgZv4cnI2CRDhp1dNTNFYex")
=> #<ScormCloud::ScormCloud:0x0000010b5b5b88
@appid="23Z8XTPJ0Z",
@secret="xCalRn4voMjyHJGARV2XgZv4cnI2CRDhp1dNTNFYex">
[2] pry(main)> sc.course
=> #<ScormCloud::CourseService:0x0000010b5dd7a0
@connection=
@kibaekr
kibaekr / user.rb
Created September 26, 2014 05:21
user
# add_column :users, :data_key, :string
# add_column :users, :data_value, :string
DATA_KEYS = ['vehicle_type', 'city', 'phone_model', 'availability', 'example_customer_service']
DATA_KEYS.each do |method|
define_method(method) do
find_by_data_key(method).try(:data_value)
end
@kibaekr
kibaekr / gist:7cd609b3b74f8003c6c9
Created April 22, 2015 03:35
error for context io
NoMethodError - undefined method `id' for nil:NilClass:
app/views/public_activity/email/_scheduler.html.erb:1:in `_app_views_public_activity_email__scheduler_html_erb__606296939798758135_2334328660'
actionview (4.1.1) lib/action_view/template.rb:145:in `block in render'
activesupport (4.1.1) lib/active_support/notifications.rb:161:in `instrument'
actionview (4.1.1) lib/action_view/template.rb:339:in `instrument'
actionview (4.1.1) lib/action_view/template.rb:143:in `render'
rack-mini-profiler (0.9.2) lib/mini_profiler/profiling_methods.rb:108:in `block in profile_method'
actionview (4.1.1) lib/action_view/renderer/partial_renderer.rb:306:in `render_partial'
actionview (4.1.1) lib/action_view/renderer/partial_renderer.rb:279:in `block in render'