Skip to content

Instantly share code, notes, and snippets.

View Robdel12's full-sized avatar
🏁
Making a PitStop

Robert DeLuca Robdel12

🏁
Making a PitStop
View GitHub Profile
@Robdel12
Robdel12 / text-shrink.js
Last active December 21, 2015 01:19
Shrink the text size based on the container width.
$(document).ready(function(){
//Span that the text lives
$('.class-name').each(function(){
//Get the width of the span
var textWidth = $(this).width();
//If the width of the span is greater than 105px then run the if.
if(textWidth > 105){
//Your class that shrinks the the font size
$(this).addClass('graph-text-smaller');
}
<!--[if lt IE 9]>
<%= stylesheet_link_tag 'ie', media: 'all' %>
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script language="javascript" type="text/javascript" src="/assets/excanvas.js"></script>
<![endif]-->
<!-- [if lt IE 9]>
<%= stylesheet_link_tag 'ie', media: 'all' %>
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script language="javascript" type="text/javascript" src="/assets/excanvas.js"></script>
<![endif] -->
@Robdel12
Robdel12 / next_page.js
Last active December 27, 2015 08:39
Personal site ajax loader
var nextPageNumber = 1;
function nextPage() {
//EX:
//http://www.robert-deluca.com/blog/page/2/
nextPageNumber++;
var pageNumber = "http://www.robert-deluca.com/blog/page/" + nextPageNumber;
//Debugging
//console.log(nextPageNumber);
//console.log(pageNumber);
return pageNumber;
@Robdel12
Robdel12 / jqplot_line_date_fix.js
Created January 8, 2014 21:25
Solving jQplot line graphs not drawing to edge of div when using DateAxisRenderer
xaxis: {
pad: 0,
padMin: 0,
padMax: 0,
min: "2013-11-07", //First date in the graph
max: "2014-01-05", //Last date in the graph
renderer: $.jqplot.DateAxisRenderer,
tickOptions:{
formatString:'%b %#d'
}
$("#normal_select").dropkick({
mobile: true
});
$("#search_select").dropkick({
mobile: true,
initialize: function() {
var $input,
dk = this;
$( '.dk-selected', dk.data.elem ).after([
'<div class="dk-search">',
'<input type="text" class="dk-search-input" placeholder="Search">',
'</div>',
].join(""));
$("#disabled").dropkick({
mobile: true
});
<select id="disabled" disabled>
<option disabled selected class="hidden-option">Choose One</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
...etc
$("#opt_group").dropkick({
mobile: true
});