Skip to content

Instantly share code, notes, and snippets.

View datt's full-sized avatar
🏠
Working from home

Dattatraya Dongare datt

🏠
Working from home
View GitHub Profile
@datt
datt / year_range.rb
Created January 12, 2015 16:01
fake year range string
# Usage YearRange.new(2).range_string
# "1990-1991 | 2011-2013"
class YearRange
def initialize(range = 1)
@range = range
@years = (1980..2015).to_a
end
def collect
divide_factor = @years.size/@range
@datt
datt / routes.rb
Last active August 29, 2015 14:19
temperory routes and controller for html pages for #FrontEnd. #tmp #controller create a folder named as tmp in views, whatever is the name of the page, can be in accessed from /page_name. e.g. if page name is /help_desk.html.haml, can be accessed as /help_desk
get '/tmp/:page' => 'tmp#index'
get '/tmp/:page/:inner_page' => 'tmp#index'

Prefix all commands with Ctrl-b

Command                                 Action

c	                      Create a new window
n	                      Change to next window
p	                      Change to previous window
"	                      Split pane horizontally
%	                      Split pane vertically
,	                      Rename current window
o	                      Move to next pane
Start and stop the server on Windows
Start and stop the server on Linux
Start and stop Apache
Start and stop the server on Windows
Start the server from the Start menu
Choose Start > All Programs > Adobe > Flash Media Server 4.5 > Start Adobe Flash Media Server 4.5.
Choose Start > All Programs > Adobe > Flash Media Server 4.5 > Start Flash Media Administration Server 4.5.
Stop the server from the Start menu
# PassengerMaxPoolSize
# Default: 6
# For 2gb RAM: 30
# For 256 slice with MySQL running: 2
PassengerMaxPoolSize 2
# PassengerPoolIdleTime
# Recommended to be avg time per page * 2
# In Google Analytics... (Avg time on site / Avg page views) * 2
# Default: 300
@datt
datt / httpd.conf
Last active December 17, 2015 09:49
1] Configuring apache2 for listening to ports other than 80. 2] Configuring apache2 for sinatra app.
Listen 3333
<VirtualHost *:80 *:3333>
ServerName local.mlb.com
railsEnv development
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /home/mahavir/projects/rails_projects/mlb_repo/mlb/public
<Directory /home/mahavir/projects/rails_projects/mlb_repo/mlb/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
<virtualhost *:80>
ServerName app.com
ServerAlias www.app.com
DocumentRoot /var/www/html/blog/public # <-- be sure to point to 'public'!
setenv RAILS_ENV production
<Directory /var/www/html/blog/public>
AllowOverride All
RailsEnv production
</Directory
ErrorLog /var/log/apache2/blog_error_log
# change past commit's author email from 'vishal@blah.\(none\)' to 'the@vishaltelangre.com'
git filter-branch --env-filter 'if [ $GIT_AUTHOR_EMAIL = vishal@blah.\(none\) ]; then GIT_AUTHOR_EMAIL=the@vishaltelangre.com; fi; export GIT_AUTHOR_EMAIL'
# change past commit's author name from 'vishal' to 'Vishal Telangre'
git filter-branch --env-filter 'if [ $GIT_AUTHOR_NAME = vishal ]; then GIT_AUTHOR_EMAIL=Vishal\ Telangre; fi; export GIT_AUTHOR_NAME'
/**
* Read the JavaScript cookies tutorial at:
* http://www.netspade.com/articles/javascript/cookies.xml
*/
/**
* Sets a Cookie with the given name and value.
*
* name Name of the cookie
* value Value of the cookie
mysqldump --user=XXXXXXXX --password=XXXXXXX -A > /PATH/TO/DUMPFILE.SQL
mysql --verbose --user=XXXXXXXX --password=XXXXXXXX DB_NAME < /PATH/TO/DUMPFILE.SQL