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
| function slugify($s, $replacement = '-', $locale = null, $lower = false, $trim = true) { | |
| $charMap = json_decode('{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"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
| function waitForWebfonts(fonts, callback) { | |
| var loadedFonts = 0; | |
| for(var i = 0, l = fonts.length; i < l; ++i) { | |
| (function(font) { | |
| var node = document.createElement('span'); | |
| // Characters that vary significantly among different fonts | |
| node.innerHTML = 'giItT1WQy@!-/#'; | |
| // Visible - so we can measure it - but not on the screen | |
| node.style.position = 'absolute'; | |
| node.style.left = '-10000px'; |
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
| (function ($) { | |
| $.fn.realWidth = function () { | |
| var els = $(this); | |
| return els.length ? els[0].getBoundingClientRect().width : null; | |
| } | |
| })(jQuery); |
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
| $.fn.reduce = function(fnReduce, initialValue) { | |
| var values = this, | |
| previousValue = initialValue; | |
| values.each(function(index, currentValue) { | |
| previousValue = fnReduce.call(currentValue, previousValue, currentValue, index, values); | |
| }); | |
| return previousValue; | |
| }; |
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
| @media screen and (min-width: ...) { | |
| // Adjust the breakpoint identifier so that jQuery knows about it | |
| #bp { | |
| color: rgb(1, 1, 1); | |
| } | |
| } | |
| @media screen and (min-width: ...) { | |
| // Adjust the breakpoint identifier so that jQuery knows about it | |
| #bp { |
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
| // Grabbed from http://de3.php.net/manual/de/function.file-get-contents.php | |
| function curl_file_get_contents($URL) { | |
| $c = curl_init(); | |
| curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($c, CURLOPT_URL, str_replace(' ', '%20', $URL)); | |
| $contents = curl_exec($c); | |
| curl_close($c); | |
| if ($contents) return $contents; | |
| else return FALSE; |
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
| function listify($delimiter) { | |
| return implode($delimiter, array_filter(array_slice(func_get_args(), 1))); | |
| } |
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
| // From http://forum.jquery.com/topic/jquery-jquery-way-for-filtering-self-all-children | |
| $.fn.findAndSelf = function(selector) { | |
| return this.find(selector).andSelf().filter(selector); | |
| } |
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
| (function ($) { | |
| $.fn.fitText = function(options) { | |
| var els = $(this), | |
| options = $.extend({ | |
| ellipsis : "..." | |
| }, options || {}); | |
| els.each(function () { | |
| var el = $(this), | |
| h = el.height(), |
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
Show hidden characters
| [ | |
| { "keys": ["super+ctrl+w"], "command": "close_all", "args": {} } | |
| ] |