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
| Instruction for Ubuntu 12.X (should work on 11.x also) | |
| a. Installing apache2 server | |
| $ sudo apt-get install apache2 | |
| Restarting apache | |
| $ sudo /etc/init.d/apache2 restart | |
| b. Installing passenger gem | |
| $ gem install passenger |
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://www.modrails.com/documentation/Users%20guide%20Nginx.html#install_on_debian_ubuntu | |
| Instruction for Ubuntu 12.X (should work on 11.x also) | |
| a. Installing passenger gem | |
| $ gem install passenger | |
| b. Installing passenger-nginx module(It will compile and install Nginx with Passenger support) | |
| IF ruby is installed without RVM |
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
| # Create .irbrc file using touch | |
| # $ touch ~/.irbrc | |
| # Add following function to .irbrc file | |
| def clear | |
| system ‘clear’ | |
| end | |
| # Open IRB with | |
| # $ irb |
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
| # Postgres | |
| development: | |
| adapter: postgresql | |
| encoding: utf8 | |
| database: text_development | |
| username: postgres | |
| password: root | |
| host: localhost | |
| # Sqlite |
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
| class ApplicationController < ActionController::Base | |
| %w(user category post comment).each do |name| | |
| define_method "find_#{name}" do | |
| obj = instance_variable_set("@#{name}", name.camelize.constantize.find_by_id(params[:id])) | |
| unless obj | |
| flash[:alert] = "#{name.camelize} not found" | |
| respond_to do |format| | |
| format.html{ redirect_to "/#{name.pluralize}" } | |
| format.js{ render js: "window.location='/#{name.pluralize}'" } |
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
| Testing | |
| https://tomafro.net/2009/05/automatching-rails-paths-in-cucumber | |
| http://asciicasts.com/episodes/155-beginning-with-cucumber | |
| http://railsapps.github.io/tutorial-rails-devise-rspec-cucumber.html | |
| Backbone | |
| https://www.youtube.com/watch?v=FZSjvWtUxYk |
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
| module KalpeshExtensions | |
| def print *args | |
| unless defined?(@log) | |
| @log = Logger.new(Rails.root.to_s + "/log/custom.log") | |
| @logger = Logger.new(Rails.root.to_s + "/log/#{Rails.env}.log") | |
| end | |
| puts "\n#{self.class.name}##{self.try(:action_name) rescue nil}\n#{'-' * 10} #{Time.now.strftime("%H:%M:%:S %P")} #{'-' * 10}" | |
| @log.info "\n#{self.class.name}##{self.try(:action_name) rescue nil}\n#{'-' * 10} #{Time.now.strftime("%H:%M:%:S %P")} #{'-' * 10}" | |
| @logger.info "\n#{self.class.name}##{self.try(:action_name) rescue nil}\n#{'-' * 10} #{Time.now.strftime("%H:%M:%:S %P")} #{'-' * 10}" |
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
| <?php | |
| // Put your device token here (without spaces): | |
| $deviceToken = 'iPHONE_TOKEN'; | |
| // Put your private key's passphrase here: | |
| $passphrase = 'kalpesh'; | |
| // Put your alert message here: | |
| $message = 'Helllooooo check this My first push notification!'; |
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
| require "rubygems" | |
| require "yajl" | |
| require "openssl" | |
| require "socket" | |
| device_token = '61 DIGIT iPhone_TOKEN' | |
| device_token = device_token.gsub(" ", "") | |
| the_byte_token = [device_token].pack("H*") | |
| file = File.open("ruby_the_byte_token", "wb") |
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
| var log; | |
| log = function() { | |
| var i = 0; | |
| while (i < arguments.length) { | |
| console.log(arguments[i]); | |
| i++; | |
| } | |
| return false; | |
| }; |
OlderNewer