Skip to content

Instantly share code, notes, and snippets.

View rutvij-pandya's full-sized avatar

Rutvij Pandya rutvij-pandya

View GitHub Profile
class Blog
# ...
attr_writer :post_source
# ...
private
def post_source
@post_source ||= Post.public_method(:new)
end
end
@rutvij-pandya
rutvij-pandya / echo_sign_api
Created January 30, 2014 07:40
EchoSign API implementation in Ruby on Rails
### Core library for EchoSign APIs
### Use a wrapper file for validations & response handling
### Get a Developer Edition account & replace "YOUR_ACCOUNT_API_KEY" with API key of your account.
### With Rails, use Savon gem for SOAP based requests.
module EchoSignApi
API_URI = 'https://secure.echosign.com/services/EchoSignDocumentService15?wsdl'
API_KEY = YOUR_ACCOUNT_API_KEY
@rutvij-pandya
rutvij-pandya / age.rb
Created February 24, 2014 11:55 — forked from emad-elsaid/age.rb
require 'time'
Date_of_birth = '1988-8-31'
# Credit to : http://stackoverflow.com/questions/4136248/how-to-generate-a-human-readable-time-range-using-ruby-on-rails
# and modified a little bit
def humanize secs
[
[60, :seconds],
[60, :minutes],
@rutvij-pandya
rutvij-pandya / backbone_hello_world
Last active August 29, 2015 14:02
a very simple example demonstrating use of backbone.js with _.js
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Hello World in Backbone.js</title>
</head>
<body>
<div id="container">Loading...</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bootstrap Demo</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
// ======= You can try below example using -
// http://trymustache.com/ ======
// == Just Copy-Paste below code in "Mustache Template section == "
{{#content}}
<div style="width: 100%;">
{{title}}
</div>
@rutvij-pandya
rutvij-pandya / zeus
Last active August 29, 2015 14:10
zeus - run rails commands faster
# zeus gem help you run rails commands faster in Development mode
# It preloads your rails app so that everytime when you execute normal development commands, it takes less than a second to execute them.
# Do not include this gem to bundle
# Go to rails project directory & run below commands
> gem install zeus # if not installed
> zeus start
@rutvij-pandya
rutvij-pandya / Debugging made easy
Created December 2, 2014 05:20
use better_errors, binding_of_caller gems & RailsPanel chrome extension with meta_request gem
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'meta_request'
end
OVERVIEW
__________________________
AngularJS is a powerful framework. In recent years, more and more of the web has become populated with AJAX-based applications, replacing static HTML pages. This is a great development for users because it makes applications much faster and richer. But making your application more responsive has come at a huge cost: crawlers are not able to see any content that is created dynamically. As a result, the most modern applications are also the ones that are often the least searchable.
PROBLEMS
__________________________
1/ The Hash Fragment (#) - AJAX URLs
2/ Dynamic content rendering using AngularJS variables
SOLUTION
@rutvij-pandya
rutvij-pandya / AWS Part 1-SSH Key generation.txt
Last active June 6, 2016 07:09
AWS Part 1 - SSH Key generation
# First step to AWS - learn to generate SSH key for servers
Generate Key in Mac
>> ssh-keygen
Give path & key name
>> Enter file in which to save the key (/Users/username/.ssh/id_rsa): /Users/username/.ssh/test_ssh
Enter password (optional)
>> Enter passphrase (empty for no passphrase):
>> Enter same passphrase again:
"Your identification has been saved in /Users/username/.ssh/test_ssh.