Skip to content

Instantly share code, notes, and snippets.

View cmthakur's full-sized avatar
🎯
Focusing

Chandra M. Thakur cmthakur

🎯
Focusing
View GitHub Profile
@cmthakur
cmthakur / Heroku Push
Created April 9, 2012 04:00
Heroku Push
rails new checkonce
cd checkonce
git init
git add .
git commit -m"init"
heroku login
gem install heroku
@cmthakur
cmthakur / git frequently used commands
Created April 25, 2012 06:17
git frequently used commands
#force push
git push -f
#track current branch to the remote
git push -u
git branch --set-upstream cmt origin/story/find_connections
#revert to the given saw
git revert <saw_id>
@cmthakur
cmthakur / sql commands
Created July 19, 2012 14:18
sql commands
#restore .sql file to the database
mysql target-db-name < sql-file-name.sql -uuser -p
# [mysql dir]/bin/mysql -h hostname -u root -p
Create a database on the sql server.
mysql> create database [databasename];
List all databases on the sql server.
mysql> show databases;
@schickling
schickling / Rakefile
Last active January 31, 2024 23:00
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@andrey-skat
andrey-skat / deploy.rb
Last active August 5, 2018 12:03
Local assets precompilation on Rails 4 using Capistrano 3
# also you need to uncomment next line in Capfile
# require 'capistrano/rails/assets'
namespace :deploy do
namespace :assets do
Rake::Task['deploy:assets:precompile'].clear_actions
desc 'Precompile assets locally and upload to servers'
task :precompile do
@jperry
jperry / remote_authenticatable.rb
Last active February 8, 2023 15:48
Devise and warden remote authentication
module Devise
module Models
module RemoteAuthenticatable
extend ActiveSupport::Concern
#
# Here you do the request to the external webservice
#
# If the authentication is successful you should return
# a resource instance
@kendagriff
kendagriff / solution.md
Created November 7, 2015 04:57
Solution to "OpenSSL::X509::StoreError: setting default path failed: Invalid keystore format" for JRuby

Solution to StoreError: invalid keystore format (OS X)

The following error appeared upon upgrading JRuby:

OpenSSL::X509::StoreError: setting default path failed: Invalid keystore format

Download cacert.pem

@cmthakur
cmthakur / repo synchronizer
Last active April 26, 2016 05:07
Repo synchronizer sync your all available repos under given directory with latest master
project_dir = "my_code_hub"
repos = Dir["#{project_dir}/*"]
success_pull = repos.map do |rep_path|
response = `cd #{rep_path}; git checkout master; git pull`;
print '=>'
rep_path.split('/').last if response.length > 0
end;