Skip to content

Instantly share code, notes, and snippets.

View jdibiccari's full-sized avatar

Janel diBiccari jdibiccari

View GitHub Profile
14149,16064,20369,18857,17446,17001,16804,16317,17168,37466,20640,15042,16448,15621,58503,12901,11250,13372,13047,11426,12373,19340,12338,12841,15391,15549,22256,19621,16421,18541,22570,17363,13027,16061,19582,15627,15630,16113,23945,16509,17513,19890,38230,23731,34761,23352,59812,31053,43482,34847,33319,24535,35282,33337,43822,36717,32577,189734,75559,33348,212749,28522,23072,32974,32096,27123,68467,27814,29473,27013,59698,21919,27556,29756,42608,24942,21646,26582,19744,4247,
@jdibiccari
jdibiccari / php_1
Created October 2, 2014 20:13
php_variable
<?php
$myName = "Janel";
echo "<h3>" . $myName . " loves Shapeways.</h3>";
?>
$('#playlist_title').on('click', '.delete-button', function() {
ajaxDeletePlaylist();
});
#You can use strftime to format expiration date in variety of acceptable ways
def js_date
self.expiration.strftime("%c")
end
#=>"Tue Jul 15 14:17:22 2014"
def js_date
self.expiration.strftime("%D %T")
end
#=> "07/15/14 14:17:22"
$(function () {
var expiration = $('#countdownClock').data('expiration');
$('#countdownClock').countdown({until: new Date(expiration)});
})
<div id="countdownClock" data-expiration="<%=@poll.js_date%>">
</div>
rails console production --sandbox
#First call instance_method on a class to get hold of a method object
#We can then ask the method object where it is defined using source_location
location = Pond.instance_method(:cool_method).source_location
#=> ["/Users/JaneldiBiccari/Development/code/rails_labs/rails-blog-nested-resources-bk-001/app/models/post.rb", 9]
#Now open to that location
`subl #{location[0]}:#{location[1]}`
@jdibiccari
jdibiccari / yaml.rb
Created July 1, 2014 11:33
blog_post
#Normal output
pond = Pond.last
#=> #<Pond id: 9, name: "Greenwood", water_type: "Murky", created_at: "2014-06-26 16:32:39", updated_at: "2014-06-26 16:32:39">
#To yaml!
y pond
--- !ruby/object:Pond
attributes:
id: 9
#Using the underscore here is a bit lazy
#but you get the idea
Pond.all
ponds = _
#=> <ActiveRecord::Relation [#<Pond id: 7, name: "Silver Frost", water_type: "Glass"...]