Skip to content

Instantly share code, notes, and snippets.

View rajraj's full-sized avatar

Rajesh Rajappan rajraj

View GitHub Profile
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@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 / es.sh
Created January 3, 2012 20:07 — forked from aaronshaf/es.sh
Install ElasticSearch on CentOS 6
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@rajraj
rajraj / gist:1834639
Created February 15, 2012 09:13
Backup and Restore MySql Database
# Backup Mysql database
$ mysqldump -u root -p contracts_production > contracts.sql
# Restore Mysql database from sql file
$ mysql -u root -p contracts_production < contracts.sql
@rajraj
rajraj / .bash_profile
Created March 29, 2012 07:25 — forked from henrik/.bashrc
Git branch and dirty state in Bash prompt.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
# Edit .bash_profile
$ nano ~/.bash_profile
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
@rajraj
rajraj / sublime_keybinings
Last active October 11, 2015 14:08
Sublime Text Keybinings
[
{ "keys": ["ctrl+shift+z"], "command": "insert_snippet", "args": {"contents": "<%= ${0:$TM_SELECTED_TEXT} %>"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html, source.yaml, meta.erb" }
]
},
{ "keys": ["ctrl+alt+x"], "command": "insert_snippet", "args": {"contents": "<% ${0:$TM_SELECTED_TEXT} %>"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html, source.yaml, meta.erb" }
]
@huskercane
huskercane / ruby_sffp_ssh_key.rb
Last active October 20, 2021 00:13
Use ruby net-sftp or net-ssh with private key authentication
require 'net/sftp'
SERVER = "127.0.0.0"
KEY_FILE = "/tmp/id_rsa"
Net::SFTP.start(SERVER, 'huskercane', :keys=>[KEY_FILE]) do |sftp|
sftp.mkdir! "/tmp/something"
#thats right needs full file name to copy
sftp.upload!("/tmp/something/something.txt", "/tmp/something/something.txt")
end
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
@mbenatti
mbenatti / 0-font-awesome-bootstap-phoenix.md
Last active February 2, 2024 14:59
Installing Bootstrap 4 + Font Awesome from NPM in Phoenix Framework using sass
  • Tested with Phoenix 1.3

1) Installing sass, font-awesome and bootstrap package's using Brunch

First, install the Sass, Font Awesome, bootstrap(and deps) package:

cd assets

  • npm install --save-dev sass-brunch
  • npm install --save font-awesome
@mwickett
mwickett / formikApollo.js
Last active December 20, 2022 23:00
Formik + Apollo
import React from 'react'
import { withRouter, Link } from 'react-router-dom'
import { graphql, compose } from 'react-apollo'
import { Formik } from 'formik'
import Yup from 'yup'
import FormWideError from '../elements/form/FormWideError'
import TextInput from '../elements/form/TextInput'
import Button from '../elements/form/Button'
import { H2 } from '../elements/text/Headings'