Skip to content

Instantly share code, notes, and snippets.

Amitesh Kumar Amitesh

Block or report user

Report or block Amitesh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Amitesh
Amitesh / convert.rake
Created Aug 9, 2012 — forked from mperham/convert.rake
Ruby script to update MySQL from Latin1 to UTF8 without data conversion
View convert.rake
desc "convert a latin1 database with utf8 data into proper utf8"
task :convert_to_utf8 => :environment do
puts Time.now
dryrun = ENV['DOIT'] != '1'
conn = ActiveRecord::Base.connection
if dryrun
def conn.run_sql(sql)
puts(sql)
end
else
@Amitesh
Amitesh / slideshow.js
Created Jan 24, 2012 — forked from qawemlilo/slideshow.js
A simple slide show
View slideshow.js
/*
Author: Qawelesizwe Mlilo
Email: qawemlilo@gmail.com
Dependency: Mootools
Notes: This code was used in a Joomla! project and can be easily modified to run without a library
*/
var slideShow = function (img, o) {
this.element = $(img);
@Amitesh
Amitesh / .htaccess
Created Dec 9, 2011 — forked from aarongustafson/.htaccess
An example of how Costco could redirect mobile requests properly
View .htaccess
# setup
RewriteEngine on
RewriteBase /
# product redirection based on iPhone and product request
# note: the user agent check is contrived, you should have
# a much more robust checker
RewriteCond %{HTTP_USER_AGENT} iPhone
RewriteCond %{QUERY_STRING} Prodid=(\d+)
RewriteRule ^Browse\/Product\.aspx http://m.costco.com/costco/product/productDirectDetail.do?itemId=%1 [R=301,L]
View backup-to-git.sh
#!/bin/bash
##
# MySQL DB dump to Git commit
#
# Dumps the specified mysql database to the given location and commits it and
# the previous database to the Git repository.
#
# It is assumed you have already setup the Git respository to only be the
# a checkout of the database backup location
@Amitesh
Amitesh / TinyMCE-config-HTML5.js
Created Dec 9, 2011 — forked from aarongustafson/TinyMCE-config-HTML5.js
Working on a TinyMCE config that supports HTML5
View TinyMCE-config-HTML5.js
// General
button_tile_map : true,
editor_selector : 'lg_mceEditor',
mode:'textareas',
theme : 'advanced',
// Cleanup/Output
apply_source_formatting : true,
convert_fonts_to_spans : true,
convert_newlines_to_brs : false,
@Amitesh
Amitesh / gist:1039620
Created Jun 22, 2011 — forked from arnabc/gitosis-repo-creation
Gitosis repo creation ( it assumes that you have a working gitosis repository in a central server and have the permission to create new repositories)
View gist:1039620
Add repo in local gitosis-admin/gitosis.conf
~$ mkdir your_repo_name
~$ cd your_repo_name
~$ git init
~$ git remote add origin git@YOUR_SERVER_HOSTNAME:your_repo_name.git
# do some work, git add and commit files
~$ git add .
~$ git commit -m 'Your Message'
You can’t perform that action at this time.