Skip to content

Instantly share code, notes, and snippets.

View kracekumar's full-sized avatar

Kracekumar kracekumar

View GitHub Profile
#controller
class UploadMaterialController < ApplicationController
def index
end
def upload
@user = current_user
@upload=UploadMaterial.new(params[:upload_material])
@upload.author=@user
if @upload.name == nil
flash[:notice]="File name empty"
>> admission_no
=> #<Student batch_id: 1>
>> subject=Subject.find_by_batch_id(1)
=> #<Subject id: 1, name: "ENGLISH", code: "E11", batch_id: 1, no_exams: false, max_weekly_classes: 4, elective_group_id: nil, is_deleted: false, created_at: "2011-04-13 17:18:10", updated_at: "2011-04-13 17:18:10">
>> subject=Subject.find_by_batch_id(admission_no)
=> nil
>>
equire File.join(File.dirname(__FILE__), 'boot')
RAILS_GEM_VERSION = '2.3.9' unless defined? RAILS_GEM_VERSION
Rails::Initializer.run do |config|
config.time_zone = 'UTC'
config.gem 'declarative_authorization', :source => 'http://gemcutter.org'
config.gem 'searchlogic'
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
init 1 root cwd unknown /proc/1/cwd (readlink: Permission denied)
init 1 root rtd unknown /proc/1/root (readlink: Permission denied)
init 1 root txt unknown /proc/1/exe (readlink: Permission denied)
init 1 root NOFD /proc/1/fd (opendir: Permission denied)
kthreadd 2 root cwd unknown /proc/2/cwd (readlink: Permission denied)
kthreadd 2 root rtd unknown /proc/2/root (readlink: Permission denied)
kthreadd 2 root txt unknown /proc/2/exe (readlink: Permission denied)
kthreadd 2 root NOFD /proc/2/fd (opendir: Permission denied)
ksoftirqd 3 root c
#controller
def add_new_chapter
@chapter=Chapter.new
@user=current_user
@subjects=[]
@subject_final=[[]]
count=0
if @user.admin?
@subjects=Subject.all(:select=>'id,name,batch_id')
puts "#{@subjects}"
>> @subjects.each {
?> |t|
?> puts t.name
>> }
MATHS
maths
=> [#<Subject id: 9, name: "MATHS", batch_id: 2>, #<Subject id: 10, name: "maths", batch_id: 3>]
>> @subjects.each { |t|
?> @subjects_all=Batch.find(t.batch_id,:select=>'name')
>> @subject_final.map{|id| t.id.to_i}
@kracekumar
kracekumar / gist:938343
Created April 23, 2011 05:14
nginx.conf
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
@kracekumar
kracekumar / environmnet.rb
Created April 25, 2011 04:55
problem with config.load_once_paths,config.load_paths
require File.join(File.dirname(__FILE__), 'boot')
RAILS_GEM_VERSION = '2.3.9' unless defined? RAILS_GEM_VERSION
Rails::Initializer.run do |config|
config.time_zone = 'UTC'
config.gem 'declarative_authorization', :source => 'http://gemcutter.org'
config.gem 'searchlogic'
#_new_multiple_choice_create_form.rb
<label class="head_label">Create New Multiple Choice Question<span></span></label>
<div id="grading-levels-form">
<% form_remote_for @question, :url=>{:action=>'new_multiple_choice'} do |f| %>
<div id="form-errors"></div>
@kracekumar
kracekumar / mail.php
Created May 1, 2011 19:02
mail not working
<?php
$allowed_type=array('application/pdf');
$max_size=2097152;
$upload_path="intern/";
function sendmail($name)
{
$name="intern";
$email=array("intern@bluebuddhacorp.com","krace@bluebuddhacorp.com","abheeshek@bluebuddhacorp.com","abheeshek_bathija@yahoo.co.in","kracethekingmaker@gmail.com");
global $allowed_type,$upload_path;
$subject="New intern has uploaded Resume ";