Skip to content

Instantly share code, notes, and snippets.

// 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')
// 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'
##########
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
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
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
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
@advorak
advorak / ERROR
Last active December 10, 2015 06:58 — forked from RemiBa/ERROR
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'
%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.
@advorak
advorak / Calendar.cfm
Created May 21, 2012 06:40 — forked from anonymous/Calendar
Calendar
<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)>
@advorak
advorak / home.css.scss
Created May 21, 2012 05:47 — forked from anonymous/home_controller.rb
Calendar for the current month
// Place all the styles related to the home controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
#monthName {
text-align: center;
position: absolute;
top: 0;
display: inline;
a {
text-decoration: none;