Skip to content

Instantly share code, notes, and snippets.

Avatar
🏁
Racing through work

Robert DeLuca Robdel12

🏁
Racing through work
View GitHub Profile
@Robdel12
Robdel12 / text-shrink.js
Last active Dec 21, 2015
Shrink the text size based on the container width.
View text-shrink.js
$(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');
}
View ie-conditional-snippet-correct.html
<!--[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]-->
View ie-conditional-snippet-wrong.html
<!-- [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 Dec 27, 2015
Personal site ajax loader
View next_page.js
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 Jan 8, 2014
Solving jQplot line graphs not drawing to edge of div when using DateAxisRenderer
View jqplot_line_date_fix.js
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'
}
View normal_select.js
$("#normal_select").dropkick({
mobile: true
});
View search_select.js
$("#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(""));
View disabled_select.js
$("#disabled").dropkick({
mobile: true
});
View disabled_select_markup.html
<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
View opt_group_select.js
$("#opt_group").dropkick({
mobile: true
});