$ rails g model User
belongs_to
has_one
| // find all elements with a z-index and indicate what they are. | |
| // uses css outline which is not supported in IE <8 | |
| function contrast(color){ return '#' + | |
| (Number('0x'+color.substr(1)).toString(10) > 0xffffff/2 ? '000000' : 'ffffff'); | |
| } | |
| jQuery('*') | |
| .filter(function(){ return $(this).css('zIndex') !== 'auto'; }) | |
| .each(function(){ |
| // Example: | |
| JavaScript.load("/javascripts/something.js"); | |
| // With callback (that’s the good thing): | |
| JavaScript.load("http://www.someawesomedomain.com/api.js", function() { | |
| API.use(); // or whatever api.js provides ... | |
| }); |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
| <title>Testing Pie Chart</title> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script> | |
| <style type="text/css"> |
| function slugify(text) | |
| { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
| <?php | |
| namespace Pokus; | |
| class Exception extends \Exception | |
| { | |
| } | |
| function tttt($string) | |
| { | |
| try { |
| // In a js file | |
| disqus_config = function() { | |
| this.callbacks.afterRender.push(function() { /* your code */ }); | |
| this.callbacks.onNewComment.push(function() { /* your code */ }); | |
| /* Available callbacks are afterRender, onInit, onNewComment, onPaginate, onReady, preData, preInit, preReset */ | |
| } |
| # United States Postal Service (USPS) abbreviations. | |
| abbreviations = [ | |
| # https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States#States. | |
| "AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "IA", | |
| "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", | |
| "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", | |
| "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI", | |
| "WV", "WY", | |
| # https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States#Federal_district. | |
| "DC", |
| <!-- Prevent FOUC (flash of unstyled content) - http://johnpolacek.com/2012/10/03/help-prevent-fouc/ --> | |
| <style type="text/css"> | |
| .no-fouc {display: none;} | |
| </style> | |
| <script type="text/javascript"> | |
| document.documentElement.className = 'no-fouc'; | |
| // add to document ready: $('.no-fouc').removeClass('no-fouc'); | |
| </script> |
| $ redis-cli | |
| > config set stop-writes-on-bgsave-error no |