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
@iMagesh
iMagesh / rake_strip_whitespace.rb
Created February 24, 2012 13:37 — forked from ashmoran/rake_strip_whitespace.rb
Simple Rake task to use sed to strip trailing whitespace from Ruby source
desc "Remove trailing whitespace for source files"
task :strip_whitespace do
files = %w[ .autotest .rspec .rvmrc Gemfile ]
globs = %w[ lib/**/*.rb spec/**/*.rb ]
files_from_globs = globs.map { |glob| Dir[glob] }
files_to_strip = (files + files_from_globs).flatten
system "sed -e 's/[ \t]*$//' -i '' #{files_to_strip.join(" ")}"
end
@iMagesh
iMagesh / rmws
Created February 24, 2012 13:36 — forked from artgillespie/rmws
Remove trailing whitespace from all source files under the current dir
#!/bin/sh
#
# Removes trailing whitespace from all source files in the current directory and its children.
# Note the `-i .bak` switch to sed. This will create a backup copy alongside any modified files
# like `Somefile.cpp.bak` Simply remove the `.bak` argument to `-i` to prevent the backup
# files from being generated
#
/usr/bin/find . -type f -and \( -name '*.m' -or -name '*.h' -or -name '*.mm' -or -name '*.cpp' -or -name '*.c' \) -and -print0 | xargs -0 sed -i .bak -E "s/[[:space:]]+$//"
@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] }
@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=""
require 'rubygems'
require 'net/http'
require 'nokogiri'
TUMBLR_USER = '[email protected]'
TUMBLR_PASS = 'yourpassword'
url = URI.parse('http://www.tumblr.com/api/write')
# Read the WP export file
@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.