This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task :migrate_wp => :environment do | |
| wp = Mysql2::Client.new(:host => "localhost", :username => "root", :password => "root", :database => "mageshblog") | |
| results = wp.query("select * from wp_zxdasg_posts;") | |
| results.each do |r| | |
| Post.create( | |
| :user_id => r["author"], | |
| :date => r["post_date"], | |
| :content => r["post_content"], | |
| :title => r["post_title"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (setq inhibit-startup-message t) ;; Removes startup message | |
| (setq-default indent-tabs-mode nil) | |
| (custom-set-variables | |
| ;; custom-set-variables was added by Custom. | |
| ;; If you edit it by hand, you could mess it up, so be careful. | |
| ;; Your init file should contain only one such instance. | |
| ;; If there is more than one, they won't work right. | |
| '(auto-save-default t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ImportedContactsController << ApplicationController | |
| require 'net/http' | |
| require 'net/https' | |
| require 'uri' | |
| #THIS METHOD TO SEND USER TO THE GOOGLE AUTHENTICATION PAGE. | |
| def authenticate | |
| # initiate authentication w/ gmail | |
| # create url with url-encoded params to initiate connection with contacts api | |
| # next - The URL of the page that Google should redirect the user to after authentication. | |
| # scope - Indicates that the application is requesting a token to access contacts feeds. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def who_to_connect | |
| @sent_invitations = current_user.sent_inv.where(:is_pending => 1).collect(&:friend_id) | |
| @friends = friends_list | |
| @friends = @friends + @sent_invitations | |
| options = %w(majors careers) | |
| @sug_list = [] | |
| options.each do |option| | |
| @my_majors = eval("current_user.#{option}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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:]]+$//" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task :weekly_report => [:environment] do | |
| @start_date=Date.today.beginning_of_week | |
| start_date=@start_date.to_date | |
| @end_date=6.days.since(@start_date) | |
| end_date=@end_date.to_date | |
| @project=Project.find_all_by_isactive(true) | |
| @proj=[] | |
| @project.each do |project| | |
| @proj << {:name => project.projectname,:billable => project.timeentries.sum(:hours_taken, :conditions=>['DATE(task_date)>=? and DATE(task_date)<=? and status=?',start_date,end_date, "Billable"]),:nonbillable => project.timeentries.sum(:hours_taken, :conditions=>['DATE(task_date)>=? and DATE(task_date)<=? and status=?',start_date,end_date, "NonBillable"]) ,:hours =>project.timeentries.sum(:hours_taken, :conditions=>['DATE(task_date)>=? and DATE(task_date)<=?',start_date,end_date])} | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task :reminder_mail => [:environment] do | |
| @users = User.active | |
| @holidays = Holiday.all | |
| @holiday_dates = [] | |
| @dates_to_check = [] | |
| @holidays.each {|h| @holiday_dates << h.holiday.to_s} | |
| (Date.new(Time.now.year, Time.now.month, 1)..Date.yesterday).each { |date| @dates_to_check << date.to_s} | |
| @users.each do |user| |