This is just a useful reference for links to various JavaScript libraries & jQuery plugins with links and CDNs.
jQuery jQuery UI jQuery Mobile Sizzle Angular Angular CDN
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
| /** | |
| * Works everywere ( IE7+, FF, Chrome, Safari, Opera ) | |
| * Example: http://jsbin.com/afAQAWA/2/ | |
| */ | |
| .rotated-text { | |
| display: inline-block; | |
| overflow: hidden; | |
| width: 1.5em; | |
| } | |
| .rotated-text__inner { |
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
| //slices up the given items in groups of size n | |
| function sliceItems(items, n) { | |
| for(i=0; i <= items.length; i+=n) { | |
| setItems(items.slice(i,i+n)); | |
| } | |
| } | |
| //gets the max height and sets all items in a slice to that height | |
| function setItems(items) { | |
| var maxHeight = Math.max.apply(null, items.map(function() |
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
| //where containerDiv is the parent of the img and a | |
| //where imgwrap is the anchor the img will be wrapped in | |
| $('.containerDiv').each(function() { | |
| $('img',$(this)).wrap('<a href="' + $('.imgwrap',$(this)).attr('href') + '"></a>'); | |
| }); | |
| $('.imgwrap').remove(); |
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
| //scrolls to a given point with offset n from point (750) | |
| scrollTo: function() { | |
| $('#main-nav').find('li > a').on("click", function(e){ | |
| $('#main-nav').find('li').removeClass('active'); | |
| $(this).parent().addClass('active'); | |
| var id = $(this).attr("href"); | |
| $('html, body').animate({ | |
| scrollTop: $(id).offset().top | |
| }, 750); | |
| e.preventDefault(); |
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
| $html = file_get_contents('http://www.example.com'); | |
| $dom = new DOMDocument(); | |
| @$dom->loadHTML($html); | |
| // grab all the on the page | |
| $xpath = new DOMXPath($dom); | |
| $hrefs = $xpath->evaluate("/html/body//a"); | |
| for ($i = 0; $i < $hrefs->length; $i++) { |
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
| //generates a csv file given an array | |
| function generateCsv($data, $delimiter = ',', $enclosure = '"') { | |
| $handle = fopen('php://temp', 'r+'); | |
| foreach ($data as $line) { | |
| fputcsv($handle, $line, $delimiter, $enclosure); | |
| } | |
| rewind($handle); | |
| while (!feof($handle)) { | |
| $contents .= fread($handle, 8192); | |
| } |
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
| <!--[if lt IE 7 ]> <body class="ie6"> <![endif]--> | |
| <!--[if IE 7 ]> <body class="ie7"> <![endif]--> | |
| <!--[if IE 8 ]> <body class="ie8"> <![endif]--> | |
| <!--[if IE 9 ]> <body class="ie9"> <![endif]--> | |
| <!--[if gt IE 9]> <body> <![endif]--> | |
| <!--[if !IE]><!--> <body> <!--<![endif]--> |
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
| //usefulness debatable - returns array of all easings given basic easing names | |
| var easings = array( | |
| 'ease_Sine', | |
| 'ease_Quad', | |
| 'ease_Cubic', | |
| 'ease_Quart', | |
| 'ease_Quint', | |
| 'ease_Expo', | |
| 'ease_Circ', | |
| 'ease_Back', |
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
| $('someEl').click(function() { | |
| $(this).animate({ | |
| 'font-size': '+=5', | |
| 'width': '-=50' | |
| }, 500, 'swing', function() { | |
| console.log("this is the callback functon"); | |
| }) | |
| }); |