Skip to content

Instantly share code, notes, and snippets.

🌴
Hoping I don't break anything

Brian Goff cpuguy83

🌴
Hoping I don't break anything
Block or report user

Report or block cpuguy83

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cpuguy83
cpuguy83 / crash1
Created Oct 17, 2013
Rbx 2.0.0 crash with sidekiq
View crash1
Rubinius Crash Report #rbxcrashreport
Error: signal �SIGSEGV
[[Backtrace]]
ruby[0x81bd52a]
[0x4001d400]
/lib/tls/i686/cmov/libc.so.6(index+0x63)[0x40233db3]
/lib/tls/i686/cmov/libnss_dns.so.2(_nss_dns_gethostbyname3_r+0xb6)[0x43ce6b66]
/lib/tls/i686/cmov/libnss_dns.so.2(_nss_dns_gethostbyname2_r+0x4b)[0x43ce6f2b]
@cpuguy83
cpuguy83 / sidekiqer.rb
Created Oct 10, 2013
Run Sidekiq in your main process
View sidekiqer.rb
require 'sidekiq/cli'
require 'sidekiq/launcher'
module Sidekiqer
Sidekiq = ::Sidekiq.dup
module Sidekiq
CLI = ::Sidekiq::CLI.dup
Launcher = ::Sidekiq::Launcher.dup
::Sidekiq.send(:remove_const, :CLI)
@cpuguy83
cpuguy83 / poller.coffee
Last active Dec 24, 2015
Poll returns immediately after the page is loaded for some reason... any ideas?
View poller.coffee
@Poller =
delay: (ms, func) -> setTimeout func, ms
poll: (url,time)->
@schedulePoll(url, time)
$.getScript(url)
schedulePoll: (url, time=30000) ->
poller = @delay(time, =>@poll(url, time))
$(document).on 'page:fetch', =>
clearTimeout(poller)
@cpuguy83
cpuguy83 / clock.rb
Last active Dec 24, 2015
Running clockwork in a separate process is for suckers...
View clock.rb
module MyApp
class Clock
include Celluloid
include Clockwork
require_relative '../clockwork'
end
end
@cpuguy83
cpuguy83 / gist:6518667
Created Sep 11, 2013
actor crash on terminate
View gist:6518667
Celluloid::DeadActorError: attempted to call a dead actor
/Users/bgoff/.gem/ruby/2.0.0/bundler/gems/celluloid-02e3882c1e55/lib/celluloid/proxies/sync_proxy.rb:23:in `method_missing'
/Users/bgoff/dev/monitor/agent/lib/agent/worker.rb:20:in `post_run'
/Users/bgoff/dev/monitor/agent/lib/agent/worker.rb:12:in `perform'
/Users/bgoff/.gem/ruby/2.0.0/bundler/gems/celluloid-02e3882c1e55/lib/celluloid/calls.rb:25:in `public_send'
/Users/bgoff/.gem/ruby/2.0.0/bundler/gems/celluloid-02e3882c1e55/lib/celluloid/calls.rb:25:in `dispatch'
/Users/bgoff/.gem/ruby/2.0.0/bundler/gems/celluloid-02e3882c1e55/lib/celluloid/calls.rb:67:in `dispatch'
/Users/bgoff/.gem/ruby/2.0.0/bundler/gems/celluloid-02e3882c1e55/lib/celluloid/actor.rb:322:in `block in handle_message'
/Users/bgoff/.gem/ruby/2.0.0/bundler/gems/celluloid-02e3882c1e55/lib/celluloid/actor.rb:416:in `block in task'
/Users/bgoff/.gem/ruby/2.0.0/bundler/gems/celluloid-02e3882c1e55/lib/celluloid/tasks.rb:55:in `block in initialize'
View pivotable.rb
# Serializes model for use with pivot.js
# https://github.com/rjackson/pivot.js
require 'csv'
module Concerns::Pivotable
extend ActiveSupport::Concern
included do
attr_reader :pivotable_attrs
@pivotable_field_options ||= []
end
View application_controller.rb
class ApplicationController < ActionController::Base
#... stuff
private
def resource_params
if params[:action] == 'new'
[]
elsif current_user.admin?
params.require(resource_instance_name).permit!
else
params.require(resource_instance_name).permit( *policy_attributes(resource_class) )
View ruby.rb
include_recipe "rbenv::default"
include_recipe "rbenv::ruby_build"
@my_ruby_version = node[:_common_system][:ruby][:version]
rbenv_ruby @my_ruby_version do |rbenv|
rbenv.ruby_version @my_ruby_version
rbenv.global true
end
def gem_install(gem)
View exeucte.rb
execute 'foo' do
command 'some_command_that_doesnt_create_its_own_file && touch /some/location/foo'
creates '/some/location/foo'
end
# or
execute 'foo' do
command 'this_command_creates_a_file_foo_in_etc'
creates '/etc/foo'
@cpuguy83
cpuguy83 / ridley_output
Created Aug 7, 2013
ridley crash on ruby 2.0
View ridley_output
Brians-MacBook-Pro:~ bgoff$ which ruby
/Users/bgoff/.rubies/ruby-2.0.0-p247/bin/ruby
Brians-MacBook-Pro:~ bgoff$ irb
irb(main):001:0> require 'ridley'
/Users/bgoff/.gem/ruby/2.0.0/gems/json-1.8.0/lib/json/common.rb:67: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
You can’t perform that action at this time.