NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
| function getStyle(el, styleProp) { | |
| var value, defaultView = el.ownerDocument.defaultView; | |
| // W3C standard way: | |
| if (defaultView && defaultView.getComputedStyle) { | |
| // sanitize property name to css notation (hypen separated words eg. font-Size) | |
| styleProp = styleProp.replace(/([A-Z])/g, "-$1").toLowerCase(); | |
| return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); | |
| } else if (el.currentStyle) { // IE | |
| // sanitize property name to camelCase | |
| styleProp = styleProp.replace(/\-(\w)/g, function(str, letter) { |
| var ALEX = ['foo', 'bar']; | |
| //n00bs write: | |
| if (ALEX.indexOf('foo') > -1) { | |
| //ALEX contains foo | |
| } | |
| //pros write: | |
| if (~ALEX.indexOf('foo')) { | |
| //ALEX contains foo |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 cedmax <http://github.com/cedmax> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| /* | |
| You can now create a spinner using any of the variants below: | |
| $("#el").spin(); // Produces default Spinner using the text color of #el. | |
| $("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el. | |
| $("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color). | |
| $("#el").spin({ ... }); // Produces a Spinner using your custom settings. | |
| $("#el").spin(false); // Kills the spinner. |
NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
| require 'formula' | |
| def ghostscript_fonts? | |
| File.directory? "#{HOMEBREW_PREFIX}/share/ghostscript/fonts" | |
| end | |
| def ghostscript_srsly? | |
| ARGV.include? '--with-ghostscript' | |
| end |
| bootstrap-tooltip.js | |
| bootstrap-popover.js | |
| bootstrap-alert.js | |
| bootstrap-button.js | |
| bootstrap-carousel.js | |
| bootstrap-collapse.js | |
| bootstrap-dropdown.js | |
| bootstrap-modal.js | |
| bootstrap-scrollspy.js | |
| bootstrap-tab.js |
| HTML | |
| ===== | |
| <script type='text/javascript'> | |
| window.jQuery || document.write('<script src="js/jquery-1.7.1.js">\x3C/script>') | |
| </script> | |
| <script src='http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js' type='text/javascript'></script> | |
| <script type='text/javascript'> | |
| window.Modernizr || document.write('<script src="js/modernizr-2.0.6.js">\x3C/script>') | |
| </script> |
| // Example 1 | |
| mediator.name = 'Doug'; | |
| mediator.subscribe('nameChange', function(arg){ | |
| console.log(this.name); | |
| this.name = arg; | |
| console.log(this.name); | |
| }); | |
| mediator.publish('nameChange', 'Jorn'); |
| Backbone.Notifications = {}; | |
| _.extend(Backbone.Notifications, Backbone.Events); |