Skip to content

Instantly share code, notes, and snippets.

@ianpetzer
ianpetzer / gdb_output_rogue_ruby_process
Created August 24, 2012 10:03
gdb output when trying debug rogue ruby process
I ran:
sudo gdbattach 12345
<--- replace "12345" with the actual PID
thread apply all bt
and got the following:
Thread 2 (Thread 0xb78bab70 (LWP 12947)):
#0 0x00e63424 in __kernel_vsyscall ()
#1 0x0055e0b1 in select () from /lib/libc.so.6
@ianpetzer
ianpetzer / ruby_gdb_output_debugging_rogue_thread
Created August 24, 2012 10:09
Output when trying to use gdb_ruby to debug cpu consuming threads
I used the ruby_gbd macros found at:
https://github.com/pusewicz/ruby-gdb
then ran:
sudo gdb /path/to/ruby PID
In gdb: I attempted to run the following commands
session-ruby
redirect_stdout # redirects gdb output to /tmp/ruby-debug.PID eval "caller" # dumps backtrace
However when I attempted to redirect the thread output to std_out, it appeared to kill the thread, as I couldn't run veal 'caller' afterwards.
(function() {
window.DS = Ember.Namespace.create({
// this one goes to 11
CURRENT_API_REVISION: 11
});
})();
@ianpetzer
ianpetzer / gist:5656120
Created May 27, 2013 09:34
Ember-data sideload opinions
DS.RESTAdapter.configure('App.Opinion', {
sideloadsAs: 'opinions'
});
@ianpetzer
ianpetzer / gist:5656129
Created May 27, 2013 09:35
Ember User model with Opinions
App.User = DS.Model.extend({
name: DS.attr('string'),
opinions: DS.hasMany('App.Opinion')
});
@ianpetzer
ianpetzer / gist:5656133
Last active December 17, 2015 18:49
User Serializer that includes Opinions
class UserSerializer < ActiveModel::Serializer
attributes :id, :name
embed :ids, include: :true
has_many :opinions
end
@ianpetzer
ianpetzer / gist:5656135
Created May 27, 2013 09:36
ActiveRecord User with Opinions
class User < ActiveRecord::Base
has_many :opinions
end
{{#linkTo 'contact' contact tagName="tr"}}
<td>{{name}}</td>
<td><button {{action destroy contact bubbles=false}}>Destroy!</button></td>
<td>{{#linkTo 'somewhere else' foo}}something{{/linkTo}}</td>
{{/linkTo}}
@ianpetzer
ianpetzer / gist:5706115
Created June 4, 2013 13:56
ExternalHosts required iOS PhoneGap wrapper app
*.google.com
*.googleapis.com
*.gstatic.com
@ianpetzer
ianpetzer / gist:5724161
Created June 6, 2013 19:22
Rake Pipeline instruction to match Ember templates, precompile them and ensure they have the correct name
match "templates/**/*.hbs" do
handlebars wrapper_proc: Barber::Ember::FilePrecompiler, :key_name_proc => ember_template_name_proc
end