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
use Merb::String => String | |
include Merb::String => String | |
extend Merb::String => String | |
class String | |
use Merb::String | |
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
C:\Users\jdeville\projects\rubyspec_o\rubyspec\core\argf | |
[90] » git diff --color | |
ESC[1mdiff --git a/core/argf/fixtures/bin_file.txt b/core/argf/fixtures/bin_file.txtESC[m | |
ESC[1mindex 2545e90..dec2cbe 100644ESC[m | |
ESC[1m--- a/core/argf/fixtures/bin_file.txtESC[m | |
ESC[1m+++ b/core/argf/fixtures/bin_file.txtESC[m | |
ESC[36m@@ -1,2 +1,2 @@ESC[m | |
ESC[31m-testESC[m | |
ESC[31m-testESC[m | |
ESC[32m+ESC[mESC[32mtestESC[m |
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
# it "has the following type signature" do | |
# TypeSignature.new(@widget, :foo). | |
# returns_nil.and. | |
# has_argument(String, "Hello").and. | |
# has_argument(Fixnum, 123).and | |
# accepts_block | |
# end | |
# I like the following better. Description can be modified, | |
# I just like the describe to explain the spec |
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
require File.dirname(__FILE__) + '/../../spec_helper' | |
describe "ObjectSpace.each_object" do | |
it "calls the block once for each living, nonimmediate object in the Ruby process" do | |
class ObjectSpaceSpecEachObject; end | |
new_obj = ObjectSpaceSpecEachObject.new | |
count = ObjectSpace.each_object(ObjectSpaceSpecEachObject) {} | |
count.should == 1 | |
# this is needed to prevent the new_obj from being GC'd too early |
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
TARGET: cs_class, cs_subclass, rb_subclass, struct | |
GENERIC_CLASS: true, false | |
GENERIC_METHOD: true, false | |
NUMBER_OF_PARAMETERS: 0,1,2,3,4,5,6,7,8 | |
STATIC: true, false | |
REF_OUT_PARAMS: none, out, ref, params | |
AOPTIONAL: true, false | |
ADEFAULT: true, false | |
AOUT: true, false | |
NULLABLE_PARAM: true, false |
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 search(arr, t) | |
min = 0 | |
max = arr.count -1 | |
mid = (max-min)/2 | |
if arr.count == 0 || (arr.count == 1 && arr[0] != t) | |
return -1 | |
elsif t <= arr[mid] | |
return search(arr[0..mid], t) | |
else | |
return mid + search(arr[mid..-1], t) |
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 option is more explicit, but not as DRY and flexible | |
module BaseValidator | |
def validate_each(rec, attr, val) | |
#calls one or two known methods | |
end | |
end | |
class AsFooValidator < ActiveModel::EachValidator | |
include BaseValidator | |
def foo #one of the known methods |
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
# Batch Request Sample 1 | |
def foo | |
end | |
#Batch Request Sample 2 | |
def bar | |
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
$(function () { | |
$('.store-page-contents .store-order-action-coupon').insertBefore('.store-order-price-subtotal'); | |
var header = $ ('<div>', {'class': 'intego-header-row'}); | |
var head = '<h4>'; | |
$(head, { | |
'class': 'intego-header-row-product', | |
'text': 'Product' | |
}).appendTo(header); |
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
(defvar growlnotify-command (executable-find "growlnotify") "The path to growlnotify") | |
(defun growl (title message) | |
"Shows a message through the growl notification system using | |
`growlnotify-command` as the program." | |
(flet ((encfn (s) (encode-coding-string s (keyboard-coding-system))) ) | |
(let* ((process (start-process "growlnotify" nil | |
growlnotify-command | |
(encfn title) | |
"-a" "Emacs" |
OlderNewer