Skip to content

Instantly share code, notes, and snippets.

View oakbow's full-sized avatar
🏠
Working from home

Oakbow oakbow

🏠
Working from home
View GitHub Profile
@voluntas
voluntas / webrtc_sfu_dev.rst
Last active April 24, 2025 12:04
WebRTC SFU コトハジメ

WebRTC SFU コトハジメ

日時:2023-12-03
作:voluntas
バージョン:2023.1
url:https://voluntas.github.io

この記事が良いと思ったらこの記事に Star をお願いします

@voluntas
voluntas / webrtc.rst
Last active March 28, 2025 06:01
WebRTC コトハジメ
@ChuckJHardy
ChuckJHardy / example_activejob.rb
Last active March 12, 2025 21:24
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end
@oakbow
oakbow / active_admin_cancan.rb
Last active August 29, 2015 14:14
ActiveAdminの検索条件から、has_manyとhas_oneを除外する ref: http://qiita.com/Oakbow/items/3d577468c0106ccc320b
module ActiveAdmin
module Filters
# lib/active_admin/filters/resource_extension.rb
# サイドバーの検索条件から、default_association_filters を対象外にする。
# has_manyやhas_oneがプルダウン条件になって恐ろしく重くなる現象の回避策。
module ResourceExtension
# Returns a default set of filters for the associations
def default_association_filters
@jasoncodes
jasoncodes / create_item_children_count.rb
Created October 23, 2011 19:04
Create ActiveRecord models for database views
class CreateItemChildrenCountView < ActiveRecord::Migration
def self.up
execute <<-SQL
CREATE VIEW item_children_count AS
SELECT parent_id AS item_id, COUNT(*) as children_count
FROM items GROUP BY parent_id;
SQL
end
def self.down
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=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')