This file contains hidden or 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 'active_support/all' | |
module Asdf | |
def self.new(connection_name, options) | |
classified_connection_name = connection_name.to_s.classify | |
self.class_eval <<-EOF | |
class #{classified_connection_name} | |
end | |
%w(aaa bbb ccc ddd).each do |letters| | |
class #{letters.classify} < #{classified_connection_name} |
This file contains hidden or 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
// I have a bunch of inputs[type=text] that contains the following ids: #name, #address, #city, #state, #zipcode | |
// $current will be set to the input#name field. | |
$current = $('input#name') | |
// I want to select all $('input') but omit the $current .. how can I do this? | |
$('input') |
This file contains hidden or 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
// how can I chain these two 'on' functions? I'm not sure this is working correctly ... | |
$('input#hospital_name, input#address').on "autocompleteselect", (e,ui) -> | |
alert 'selected' | |
.on "autocompletechange" (e,ui)-> | |
alert 'changed' |
This file contains hidden or 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
########## | |
json_object.is_a?(String) # Returns true if json_object is an array, else false | |
json_object.is_a?(Array) # Returns true if json_object is an array, else false | |
############ | |
case json_object | |
when String | |
#do something here if string |
This file contains hidden or 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 'prawn' | |
def name | |
'Andy' | |
end | |
# When I don't specify a block variable, @name is neglected and the output | |
# to a pdf file is (approximately): "\nmore text" | |
pdf = Prawn::Document.new do | |
text name |
This file contains hidden or 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 view | |
@ibs = <<-EOF | |
this is a test | |
testing | |
1 2 3 | |
4 5 6 | |
EOF | |
#=> "this is a test\ntesting\n\n1 2 3\n 4 5 6" | |
end |
This file contains hidden or 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 'prawn' | |
define_grid columns: 3, rows: 1, gutter: 0 | |
3.times do |i| | |
grid(0,i).bounding_box do | |
# How can I the left and right borders with a line size of 5 | |
# and the top and bottom borders with a line size of 1? | |
stroke_bounds | |
end |
This file contains hidden or 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
NoMethodError in OrderitemsController#create | |
undefined method `stringify_keys' for #<Order:0x2c630a0> | |
Application Trace | Framework Trace | Full Trace | |
app/controllers/orderitems_controller.rb:11:in `create' | |
This file contains hidden or 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
%table | |
%tr | |
%td This is cell 0,0 | |
%td This is cell 0,1 | |
%tr | |
%td{colspan: 2} | |
%table | |
%tr | |
%td This is a cell on its own in a table all its own. |
This file contains hidden or 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
<cfoutput> | |
<table border="1" width="100%" height="100%"> | |
<tr> | |
<cfloop index="x" from="1" to="7"> | |
<th>#dayOfWeekAsString(x)#</th> | |
</cfloop> | |
</tr> | |
</cfoutput> | |
<cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> |