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 ajax_get(url, callback) { | |
| var xmlhttp = new XMLHttpRequest(); | |
| xmlhttp.onreadystatechange = function() { | |
| if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { | |
| console.log('responseText:' + xmlhttp.responseText); | |
| try { | |
| var data = JSON.parse(xmlhttp.responseText); | |
| } catch(err) { | |
| console.log(err.message + " in " + xmlhttp.responseText); | |
| return; | 
  
    
      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
    
  
  
    
  | [http://blog.teamtreehouse.com/increase-your-sites-performance-with-hardware-accelerated-css](http://blog.teamtreehouse.com/increase-your-sites-performance-with-hardware-accelerated-css) | |
| .cube { | |
| -webkit-transform: translate3d(250px,250px,250px) | |
| rotate3d(250px,250px,250px,-120deg) | |
| scale3d(0.5, 0.5, 0.5); | |
| } | |
| In some cases, you might not want a 3D transformation on the element, but still take advantage of GPU acceleration. That’s when a few simple CSS properties come in handy that trick the browser into triggering GPU acceleration. | |
| Even though we’re not animating an element in 3D space, we can enable 3D rendering. At the very least, the transform: translateZ(0); declaration triggers GPU acceleration in modern desktop and mobile browsers. This seems to be the most effective way of triggering GPU acceleration (all vendor prefixes included): | 
  
    
      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
    
  
  
    
  | /** | |
| * if browser doesn't have navigator.clipboard, use this to copy the url to clipboard | |
| * @param text | |
| */ | |
| export const fallbackCopyTextToClipboard = (text) => { | |
| let textArea = document.createElement('textarea') | |
| textArea.value = text | |
| document.body.appendChild(textArea) | |
| textArea.focus() | |
| textArea.select() | 
  
    
      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
    
  
  
    
  | $.validator.addMethod('requireOne', function (value, element) { | |
| return $(element).closest('.form-group').find('input.require-one:checked').size() > 0; }, 'Please check at least one box.'); | 
  
    
      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
    
  
  
    
  | jQuery.validator.addMethod("noSpace", function(value, element) { | |
| return $.trim(value) != ""; | |
| }, "No space please and don't leave it empty"); | |
  
    
      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
    
  
  
    
  | rails g model Favorites posts:references user:references | |
| rake db:migrate | |
| rails g controller Favorites update | |