See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| // set the default amount of items being displayed | |
| $scope.limit= 5; | |
| // loadMore function | |
| $scope.loadMore = function() { | |
| $scope.limit = $scope.items.length | |
| } |
| class @GoogleAnalytics | |
| @load: -> | |
| # Google Analytics depends on a global _gaq array. window is the global scope. | |
| window._gaq = [] | |
| window._gaq.push ["_setAccount", GoogleAnalytics.analyticsId()] | |
| # Create a script element and insert it in the DOM | |
| ga = document.createElement("script") | |
| ga.type = "text/javascript" |
There are many (old) clients available:
The Google Analytics API is at v3 (at time of writing).
This example uses Google's Ruby API client to access Analytics. Use https://github.com/google/google-api-ruby-client (Google supported).
In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.
| <!DOCTYPE html> | |
| <html lang="ja"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Hello FB</title> | |
| </head> | |
| <body> | |
| <div id="fb-root"></div> | |
| <div id="fb-content"></div> | |
| <div> |
| When building a new instance of Amazon EC2 choose quick-start-1 as the security group not default | |
| #LOCALLY | |
| $ capify . | |
| $ chmod +x config/unicorn_init.sh | |
| $ git add . | |
| $ git commit -m "deployment configs" | |
| If rebuilding an instance don't forget to remove the ssh keys |
| # from https://github.com/ruby-china/ruby-china/blob/master/app/helpers/application_helper.rb | |
| MOBILE_USER_AGENTS = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' + | |
| 'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' + | |
| 'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' + | |
| 'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' + | |
| 'webos|amoi|novarra|cdm|alcatel|pocket|iphone|mobileexplorer|mobile' | |
| def mobile? | |
| agent_str = request.user_agent.to_s.downcase | |
| return false if agent_str =~ /ipad/ |
| #!/usr/bin/env ruby | |
| # An HTTP/HTTPS/FTP file downloader library/CLI based upon MiniPortile's | |
| # HTTP implementation. | |
| # | |
| # Author: Jon Maken | |
| # License: 3-clause BSD | |
| # Revision: 2012-03-25 23:01:19 -0600 | |
| require 'net/http' | |
| require 'net/https' if RUBY_VERSION < '1.9' |
| // Placeholder @mixin for Sass | |
| // | |
| // A mixin to style placeholders in HTML5 form elements. | |
| // Includes also a .placeholder class to be used with a polyfill e.g. | |
| // https://github.com/mathiasbynens/jquery-placeholder | |
| // Requires Sass 3.2. | |
| // | |
| // Example usage (.scss): | |
| // | |
| // input { |