$ rails g model User
belongs_to
has_one
| // 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 */ | |
| } |
| <?php | |
| namespace Pokus; | |
| class Exception extends \Exception | |
| { | |
| } | |
| function tttt($string) | |
| { | |
| try { |
| 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 | |
| } |
| <!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"> |
| // 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 ... | |
| }); |
| // 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(){ |