Skip to content

Instantly share code, notes, and snippets.

View rajraj's full-sized avatar

Rajesh Rajappan rajraj

View GitHub Profile
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require File.dirname(__FILE__) + '/blueprints'
require 'faker'
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/pride'
class MiniTest::Unit::TestCase
include MiniTest::ActiveRecordAssertions
Running `mix ecto.migrate` attached to terminal... up, run.6992
** (Postgrex.Error) tcp connect: econnrefused
(ecto) lib/ecto/adapters/sql/worker.ex:29: Ecto.Adapters.SQL.Worker.query!/4
(ecto) lib/ecto/adapters/sql.ex:187: Ecto.Adapters.SQL.use_worker/3
(ecto) lib/ecto/adapters/postgres.ex:59: Ecto.Adapters.Postgres.ddl_exists?/3
(ecto) lib/ecto/migration/schema_migration.ex:19: Ecto.Migration.SchemaMigration.ensure_schema_migrations_table!/1
(ecto) lib/ecto/migrator.ex:36: Ecto.Migrator.migrated_versions/1
(ecto) lib/ecto/migrator.ex:134: Ecto.Migrator.run/4
(mix) lib/mix/cli.ex:55: Mix.CLI.run_task/2
https://www.youtube.com/watch?v=fzJcrH6dGGs
/*
=skin=
@name Simpliquity
@author Yatrik Solanki
@homepage http://www.yatriksolanki.com
@email yatriksolanki@gmail.com
@license MPL/LGPL/GPL
namespace :trant do
desc "Send email notifications for a project."
task :send_notification => :environment do
Project.send_notification
end
end
echo off
REM cd into your rails app folder
cd e:\webapps\projects
REM Then Call the rake task
call rake trant:send_notification
@rajraj
rajraj / rapleaf.rake
Created March 17, 2011 22:45
Rapleaf Name to Gender API
namespace :ycpages do
desc "Update person gender using RapLeaf's name to gender API."
task :update_gender => :environment do
Person.all.each do |person|
unless person.gender.present?
url = "http://api.rapleaf.com/v4/util/name_to_gender/#{person.name.split.first}"
response = Net::HTTP.get_response(URI.parse(url))
result = JSON.parse(response.body)
if ((result["status"] == "OK") && (result["answer"]["likelihood"].to_f > 0.9))
person.update_attribute(:gender, result["answer"]["gender"])
$(function(){
// Collect all text boxes
$textboxes = $(":text");
// call checkForEnter function when a key is pressed
$textboxes.keydown(checkForEnter);
// This function checks if the Enter key is pressed
// If yes then moves the cursor to the next box
function checkForEnter(event) {
@rajraj
rajraj / ubuntu
Created November 3, 2011 19:46
Ubuntu System Setup
#!/usr/bin/env bash
# bash < <(curl -s https://???)
echo "Checking for SSH key, generating one if it exists ..."
[[ -f ~/.ssh/id_rsa.pub ]] || ssh-keygen -t rsa
echo "Copying public key to clipboard. Paste it into your Github account ..."
[[ -f ~/.ssh/id_rsa.pub ]] && cat ~/.ssh/id_rsa.pub | xclip
open https://github.com/account/ssh
@rajraj
rajraj / gist:1388849
Created November 23, 2011 14:46
Capybara Reference
# Credit: http://richardconroy.blogspot.com/2010/08/capybara-reference.html
#Navigating
visit('/projects')
visit(post_comments_path(post))
#Clicking links and buttons
click_link('id-of-link')
click_link('Link Text')
click_button('Save')