Skip to content

Instantly share code, notes, and snippets.

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

Magesh iMagesh

🏠
Working from home
View GitHub Profile
var now = new Date();
var currMonth = now.getMonth();
var currYear = now.getFullYear();
var date = now.getDate();
var weekDay = new Array(7);
weekDay[0] = "Sun";
weekDay[1] = "Mon";
weekDay[2] = "Tue";
@iMagesh
iMagesh / textbooks.rake
Created August 13, 2009 11:03
this is my first ruby script..for rake tasks.. used to populate the database with the students textbook info
namespace :sp do
authors = %w/Magesh Bala Vikram Abraham Imran Satish Harish Varun Jayamohan Ramesh Raghuvamsan Yogesh Yuvaraja Ranjith Kavitha Safia Surya Priya Shalini Priyanka/
publishers = ["Tamil Nadu TextBook Corporation"]
al = authors.length
pl = publishers.length
task :textbooks => :environment do
TextBook.delete_all
@iMagesh
iMagesh / wp2tumblr
Created October 12, 2010 19:13 — forked from mwunsch/wp2tumblr
#!/usr/bin/env ruby
## WP2TUMBLR: WordPress 2 Tumblr Importing tool
##
## Usage: wp2tumblr [OPTION] WORDPRESS_XML_FILE
##
## Import the WORDPRESS_XML_FILE to a Tumblr blog.
## Provide `--group` option to publish to a group.
## This could take a long time...
##
## To install, download the script and chmod to 755.
require 'rubygems'
require 'net/http'
require 'nokogiri'
TUMBLR_USER = 'your@email.com'
TUMBLR_PASS = 'yourpassword'
url = URI.parse('http://www.tumblr.com/api/write')
# Read the WP export file
@iMagesh
iMagesh / office-emacs.el
Created January 12, 2012 09:26
office emacs settings
;; Interactively Do Things (highly recommended, but not strictly required)
;; (require 'ido)
;; (ido-mode t)
;; Rinari
(add-to-list 'load-path "/etc/emacs/site-start.d/rinari")
(require 'rinari)
;; Emacs Titanium mode
; (add-to-list 'load-path "/etc/emacs/site-start.d/emacs-titanium")
@iMagesh
iMagesh / wp-install.sh
Created January 13, 2012 05:38 — forked from matiskay/wp-install.sh
Wordpress Install
#!/bin/bash
if [[ ! -n $1 ]]; then
echo "Please insert a project name"
exit 1
fi
# Mysql Config
MYSQL_USER=""
@iMagesh
iMagesh / nginx-wordress.conf
Created January 23, 2012 19:50
nginx-wordpress.conf
server {
listen 80;
server_name sub.domain.com;
root /path/to/garden;
index index.php index.html;
location / {
if (-f $request_filename) {
break;
@iMagesh
iMagesh / will_paginate.js
Created January 27, 2012 12:21
Ajaxify will_paginate
function fetchParams(link){
var vars = [], hash;
var hashes = link.slice(link.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
@iMagesh
iMagesh / tv-remote.rb
Created February 13, 2012 22:32
watch tv
@low_channel = 1 # lowest channel
@high_channel = 10 # highest channel
@blocked = [2, 6, 8] # blocked channels
@channels_to_visit = [9,1,2,3,9] #channels to watch
flash = 0
click1 = 0
click2 = 0
click3 = 0
click4 = 0
@iMagesh
iMagesh / heroku.rake
Created February 17, 2012 07:06 — forked from myronmarston/heroku.rake
Rake task to download a sql dump from a heroku app
namespace :heroku do
def app_name
@app_name ||= Heroku::Command::BaseWithApp.new([]).app
end
def latest_bundle(timeout = 30)
puts "Attempting to get latest bundle..."
get_bundle = lambda do
bundles = Heroku::Command.run('bundles', {})
bundles.sort { |b1, b2| b1[:created_at] <=> b2[:created_at] }