This file contains 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 URL-friendly "slug" from a provided string. | |
// For example: "This Is Great!!!" transforms into "this-is-great" | |
function generateSlug (value) { | |
// 1) convert to lowercase | |
// 2) remove dashes and pluses | |
// 3) replace spaces with dashes | |
// 4) remove everything but alphanumeric characters and dashes | |
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, ''); | |
}; |
This file contains 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
// based on http://emptysquare.net/blog/adding-an-include-tag-to-underscore-js-templates/ | |
// include tag for underscore templates | |
// <% include template-id %> | |
var _underscore_template = _.template; | |
_.template = function(str, data) { | |
// match "<% include template-id %>" | |
return _underscore_template( | |
str.replace( | |
/<%\s*include\s*(.*?)\s*%>/g, |
This file contains 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 fileSizeFormat( num_bytes ) { | |
if ( ! num_bytes ) return '0 bytes'; | |
typeof num_bytes == 'number' || ( num_bytes = parseFloat( num_bytes ) ); | |
if ( isNaN( num_bytes ) ) return ''; | |
var i = -1; | |
var byteUnits = [ 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; | |
do { | |
num_bytes = num_bytes / 1000; | |
i++; |
This file contains 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
<script type="text/javascript"> | |
(function () { | |
"use strict"; | |
// once cached, the css file is stored on the client forever unless | |
// the URL below is changed. Any change will invalidate the cache | |
var css_href = './index_files/web-fonts.css'; | |
// a simple event handler wrapper | |
function on(el, ev, callback) { | |
if (el.addEventListener) { | |
el.addEventListener(ev, callback, false); |
This file contains 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
;;; auto-remove.el --- Auto remove unused functions in python | |
;;; Commentary: | |
;; Uses external tool autoflake to remove unused imports from a Python file. | |
;;; Code: | |
(defcustom python-autoflake-path (executable-find "autoflake") | |
"Autoflake executable path. |