Skip to content

Instantly share code, notes, and snippets.

@ticket = Ticket.last
@ticket.patches.size #=> 0
patch = @ticket.patches.find_or_initialize_by_user('Matt')
@ticket.patches.size #=> 1
@ticket.patches.last.new_record? #=> true
patch.save
@ticket.patches.size #=> 2 <-- wait wut?
@ticket.patches.last.new_record? #=> true
@post = Post.first
@post.comments.size #=> 2
@post.comments.new
@post.comments.size #=> 3
@post.comments.last.new_record? #=> true
var chatData = JSON.stringify({
timestamp: (currentDate.getTime() - currentDate.getMilliseconds()) / 1000
, chat: {
employee_id: employeeId
, created_at: chat.created_at
, username: chat.chatname
, message: chat.message
}
});
1 rb_gc_mark (in ruby) + 55 [0x100039d47]
1457 Thread_33491: SamplerThread
1457 thread_start (in libsystem_c.dylib) + 13 [0x7fff8bdf8b75]
1457 _pthread_start (in libsystem_c.dylib) + 335 [0x7fff8bdf58bf]
1457 _ZN2v88internalL11ThreadEntryEPv (in v8.bundle) + 85 [0x102dd4d75]
1457 v8::internal::SamplerThread::Run() (in v8.bundle) + 55 [0x102dd55c7]
1457 v8::internal::RuntimeProfilerRateLimiter::SuspendIfNecessary() (in v8.bundle) + 120 [0x102dedbc8]
1457 semaphore_wait_trap (in libsystem_kernel.dylib) + 10 [0x7fff8d2f96b6]
Total number in stack (recursive counted multiple, when >=5):
<intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:scheme="vnd.android.nfc"
          android:host="ext"
          android:path="/example.com:demo" />
</intent-filter>
<intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:scheme="vnd.android.nfc"
          android:host="ext"
          android:pathPrefix="/example.com:" />
</intent-filter>
From e80252e48de52485e5d1a68f0cea2e7420326abe Mon Sep 17 00:00:00 2001
From: Matthijs Langenberg <[email protected]>
Date: Mon, 24 Jan 2011 11:37:14 +0100
Subject: [PATCH] Prevent ActiveRecord SessionStore from saving non-dirty sessions.
---
activerecord/lib/active_record/session_store.rb | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb
/**
* Get the ISO week date week number
* Matthijs: implementation is not correct!
* Added so you can grasp the idea
*/
Date.prototype.getWeek = function () {
// Create a copy of this date object
var target = new Date(this.valueOf());
// ISO week date weeks start on monday
@mlangenberg
mlangenberg / gist:713368
Created November 24, 2010 09:11
/etc/service/foo/run
#!/bin/sh
while [ true ]
do
sleep 1
echo "Hello"
done
var sys = require('sys'),
http = require('http');
var client = http.createClient(666, '127.0.0.1');
client.on('error', function() {
sys.log('error during http request');
})
setInterval(function() {
sys.log("trying http request");