Skip to content

Instantly share code, notes, and snippets.

html = '''
<table class='dashboard'>
<tr>
<td>
<div class="books_list"></div>
<div class = courses_list"></div>
</td>
<td>
<div class = "documnets_list"></div>
</td>
file = File.open '...'
Lang.ruby(file, :buffer => 2)
Lang.python(file, :buffer => 3)
Lang.go(file, :buffer => 4)
Lang.javascript(file, :buffer => 12)
Lang.java(file, :buffer => 6)
file = File.open '...'
Lang.ruby file, :buffer => 2
Lang.python file, :buffer => 3
file = File.open '...'
Lang.ruby(file, :buffer => 2)
Lang.python(file, :buffer => 3)
Lang.go(file, :buffer => 4)
Lang.javascript(file, :buffer => 12)
Lang.java(file, :buffer => 6)
file = File.open '...'
Lang.ruby file, :buffer => 2
Lang.python file, :buffer => 3
def create
attrs = params[:group_question]
group_id = params[:group_id]
if @group = Group.find group_id
@question = _user.group_question group, attrs
@result = @question.errors.messages.map{|k,v| "#{v[0]}<br/>" } unless @question.save
end
json_only_action
end
def index
id = params[:group_id]
group = Group.find id
@questions = group.questions
@allow = _user.allowed? group
end
def index
@g_questions = GroupQuestion.where('group_id = ?',params[:group_id]) if params[:group_id].present?
group = Group.find(params[:group_id])
@allow = group.instructor_id == _user.id
end
@notesolution
notesolution / gist:2924925
Created June 13, 2012 15:52 — forked from michaelRM/gist:2924822
credit_card partial conditional
-if model.is_a?(Product)
= form_for purchase, :url => [model,purchase], :method => :post do |f|
...
@notesolution
notesolution / gist:2919356
Created June 12, 2012 18:51
Wistia Upload Widget API
<!DOCTYPE html>
<html>
<head>
<title>Wistia Upload Widget via API </title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style>
#wistia { width: 500px; height: 75px; }
</style>
</head>
<body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Tester</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<div id="wistia-upload-widget" style="width: 500px; height: 75px;"></div>
<div id="wistia-upload-widget-2" style="width: 500px; height: 75px;"></div>
<div id="wistia-upload-widget-3" style="width: 500px; height: 75px;"></div>
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
function precmd() {
PROMPT="%n@%m %~$(parse_git_branch)%# "
}
function proml {
local BLUE="\[\033[0;34m\]"