Skip to content

Instantly share code, notes, and snippets.

View Amitesh's full-sized avatar

Amitesh Kumar Amitesh

View GitHub Profile
@Amitesh
Amitesh / convert.rake
Created August 9, 2012 10:05 — forked from mperham/convert.rake
Ruby script to update MySQL from Latin1 to UTF8 without data conversion
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 January 24, 2012 12:18 — forked from qawemlilo/slideshow.js
A simple slide show
/*
Author: Qawelesizwe Mlilo
Email: [email protected]
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 December 9, 2011 12:53 — forked from aarongustafson/.htaccess
An example of how Costco could redirect mobile requests properly
# 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]
@Amitesh
Amitesh / backup-to-git.sh
Created December 9, 2011 12:53 — forked from aarongustafson/backup-to-git.sh
DB Backup to Git
#!/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 December 9, 2011 12:37 — forked from aarongustafson/TinyMCE-config-HTML5.js
Working on a TinyMCE config that supports HTML5
// 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 June 22, 2011 07:05 — 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)
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'