This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This helper module provides Mock library "patch" abilities | |
# while integrating with the unittest test classes in a way | |
# to reduce the verbosity of their API. | |
# | |
# Use like so: | |
# | |
# from sync.mocking_helper import patch_me | |
# | |
# class MyClassTest(object): | |
# def setUp(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xbmc, xbmcgui | |
#get actioncodes from keymap.xml | |
ACTION_PREVIOUS_MENU = 10 | |
class MyClass(xbmcgui.Window): | |
def __init__(self): | |
self.strActionInfo = xbmcgui.ControlLabel(100, 120, 200, 200, '', 'font13', '0xFFFF00FF') | |
self.addControl(self.strActionInfo) | |
self.strActionInfo.setLabel('Push BACK to quit') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/call_info_test.rb b/test/call_info_test.rb | |
index 5914da4..f9839e1 100644 | |
--- a/test/call_info_test.rb | |
+++ b/test/call_info_test.rb | |
@@ -22,9 +22,37 @@ class CallInfoTest < Test::Unit::TestCase | |
# assert_equal(call_info.total_time, call_info_clone.total_time) | |
# end | |
+ class AceOfSpades | |
+ def initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interview Questions: | |
What does the following evaluate to: “int a=((1<<7)|(1));” |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def log_debug(text) | |
RAILS_DEFAULT_LOGGER.debug("\e[41m #{text} \e[0m") | |
end | |
def db(text) | |
log_debug(text) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Outputs the default formats for Date, Datetime, and Time Ruby classes. | |
# Stolen from http://onrails.org/2008/08/20/what-are-all-the-rails-date-formats | |
desc "Show the date/time format strings defined and example output" | |
task :date_formats => :environment do | |
now = Time.now | |
[:to_date, :to_datetime, :to_time].each do |conv_meth| | |
obj = now.send(conv_meth) | |
puts obj.class.name | |
puts "=" * obj.class.name.length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project % livereload 9:44 | |
Version: 1.4 (compatible with browser extension versions 1.4.x) | |
Port: 35729 | |
Watching: /Users/user/sandbox/active/project | |
- extensions: .html .css .js .png .gif .jpg .php .php5 .py .rb .erb | |
- excluding changes in: */.git/* */.svn/* */.hg/* | |
- with a grace period of 0.05 sec after each change | |
LiveReload is waiting for browser to connect. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Hobo | |
module Permissions | |
def self.included(klass) | |
klass.class_eval do | |
Hobo::Permissions::Associations.enable | |
extend ClassMethods | |
alias_method_chain :create, :permission_check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Something change in Rails 2.3.2 since 2.1.2, and I'm not sure what, or how to handle it. | |
Watch how the 'role' column (which the below shows that it is a private method, even though | |
it's just a column in the users table) gets handled by the different versions. | |
Rails 2.3.2 throws an error when first getting it, 2.1.2 doesn't. | |
Both update their classes to show that its not a private method after it has been set once! | |
In Rails 2.3.2: | |
===================================== | |
Loading development environment (Rails 2.3.2) | |
>> cols = User.columns.map {|c| c.name} |
NewerOlder