Skip to content

Instantly share code, notes, and snippets.

View TheAshwanik's full-sized avatar
💭
Hi.. Don't hesitate to ping me.. I would love an interesting chat about tech.

Ashwani Kumar TheAshwanik

💭
Hi.. Don't hesitate to ping me.. I would love an interesting chat about tech.
View GitHub Profile
#in your view
<%= form_for @post, remote: true do |f| %>
#form inputs
<% end %>
#then in your controller
def do_something
//= require bootbox.min
@TheAshwanik
TheAshwanik / CSS
Last active December 23, 2015 05:29
A Gist for jQuery plugin for Email Address like on FB & Google+? http://jsbin.com/UjOJip/8
body{
font-family:Helvetica,Arial;
background:#f4f4f4;
}
h2{
font-weight:normal;
}
#invite{
position:relative;
background:#fff;
@TheAshwanik
TheAshwanik / index.html
Created September 14, 2013 08:13 — forked from miry/index.html
This is a simple Sinatra application with sample of cross domain sharing resource.
<html>
<head>
<title>
Demo Cross Domain
</title>
<!-- Le styles -->
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<style>
body {
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
# For all responses in this controller, return the CORS access control headers.
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
class ApplicationController < ActionController::Base
...
#Problem:
#In rails 3.0.1+ it is no longer possible to do this anymore;
# rescue_from ActionController::RoutingError, :with => :render_not_found
#
#The ActionController::RoutingError thrown is not caught by rescue_from.
#The alternative is to to set a catch-all route to catch all unmatched routes and send them to a method which renders an error
#As in http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution
@TheAshwanik
TheAshwanik / Top_command_help.txt
Created August 23, 2013 17:02
Help for Top Command
===============================================================================
Help for Interactive Commands - procps version 3.2.7
Window 1:Def: Cumulative mode Off. System: Delay 3.0 secs; Secure mode Off.
Z,B Global: 'Z' change color mappings; 'B' disable/enable bold
l,t,m Toggle Summaries: 'l' load avg; 't' task/cpu stats; 'm' mem info
1,I Toggle SMP view: '1' single/separate states; 'I' Irix/Solaris mode
f,o . Fields/Columns: 'f' add or remove; 'o' change display order
F or O . Select sort field
@TheAshwanik
TheAshwanik / Rails-SSL-Cert Related.md
Last active December 21, 2015 14:28 — forked from fnichol/README.md
Rails-SSL Cert Related
require 'roo'
# Spreadsheet courtesy of the A List Apart 2010 Web Design Survey:
# http://www.alistapart.com/articles/survey2010
workbook = Excel.new('a-list-apart-web-design-survey-sample.xls')
# Set the worksheet you want to work with as the default worksheet. You could
# also iterate over all the worksheets in the workbook.
workbook.default_sheet = workbook.sheets[0]