Skip to content

Instantly share code, notes, and snippets.

@augustovictor
augustovictor / autogrow.js
Created February 23, 2012 03:14
Autogrow textarea
var heightScroll = $("textarea").get(0).scrollHeight; //Receives scroll height
var heightTextarea = $("textarea").height(); //Receives textarea height
var height = heightTextarea;
for(height; heightScroll > heightTextarea; height++) {
heightTextarea = height; //Textarea height receives the current height
$("textarea").css("height", height); //Textarea height receives the height value changed
}
<div id="ttNewsBoxTxt">
<p class="ttNewsTxt">
</p><div class="demo">
<div class="tweet query"><ul class="tweet_list"><li class="noneStyleList tweet_first tweet_odd"><span class="tweet_text">Que bom! Estamos no Twitter!</span></li></ul></div>
</div>
<p></p>
</div>
<div id="ttNewsBoxTxt">
<p class="ttNewsTxt">
<div class="demo">
</div>
<div class"tweet query"> </div>
</p>
</div>
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return
#menuContainer ul li {
-moz-transition: 0.5s;
-webkit-transition: 0.5s;
border-bottom: 1px solid transparent;
color: #6B6B6B;
cursor: pointer;
display: inline;
text-decoration: none;
font: normal 15px Arial, Helvetica, sans-serif;
list-style-type: none;
create user "victor" identified by "bd1" default tablespace users account unlock;
grant connect to "victor";
commit work;
priority_class(priorityLvl)
if priorityLvl == 0
priorityBg = 'low'
if priorityLvl == 1
priorityBg = 'normal'
if priorityLvl == 2
priorityBg = 'high'
create or replace procedure(v_nome funcionario.nome%type, v_funcao funcionario.funcao%type)
is
begin
insert into funcionario values(seqFuncionario.nextval, v_nome, v_funcao);
end;
class Project < ActiveRecord::Base
before_save :titleize_name
before_create :define_owner
attr_accessible :description, :name
validates :name, presence: true
belongs_to :owner, class_name: 'User', foreign_key: 'user_id'
p = u.projects.new
=> #<Project id: nil, name: nil, description: nil, created_at: nil, updated_at: nil, user_id: nil>
1.9.2p290 :007 > p.name = 'Project test'
=> "Project test"
1.9.2p290 :008 > p.user_id = u
=> #<User id: 1, email: "victor@gmail.com", encrypted_password: "$2a$10$Ztr8sTf9R5Wuw6YLlcGbmueg8EQX7sFpKTPlUngwrSZa...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 5, current_sign_in_at: "2013-01-02 12:32:17", last_sign_in_at: "2012-12-03 01:53:59", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2012-11-21 14:45:09", updated_at: "2013-01-02 13:45:21", name: "Victor Augusto Pinto costa", login_name: "victoraweb">
1.9.2p290 :009 > p.save
(0.2ms) BEGIN
SQL (0.7ms) INSERT INTO `projects` (`created_at`, `description`, `name`, `updated_at`, `user_id`) VALUES ('2013-01-07 06:20:00', NULL, 'Project Test', '2013-01-07 06:20:00', 1)
(0.6ms) COMMIT