Skip to content

Instantly share code, notes, and snippets.

Element.addMethods({
png_fix: function(el) {
var el = $(el);
var pos = navigator.userAgent.indexOf("MSIE ");
if (!(Prototype.Browser.IE && el.match('img') && el.src.include('png')) || pos == -1 )
return el;
var version = navigator.userAgent.substring(pos + 5);
if (! (((version.indexOf("5.5") == 0) || (version.indexOf("6") == 0)) && (navigator.platform == ("Win32"))) )
var photos = $(document).getElementsByClassName('user_photo');
$A(photos).each( function(e){
var gift = gifts[e.readAttribute('user_id')];
if(!gift) return;
var oy = e.getHeight() - gift['offset_y'], ox = 0 - gift['offset_x'];
var gi = new Element('img', {'class':'gift',
'height':'29px','width':'40px',
'style':'position:absolute;margin-top:'+oy+'px;margin-left:'+ox+'px;'
});
gi.src = gift['url'];
set :git_reuse_repo, true
class Vlad::Git
def checkout(revision, destination)
destination = File.join(destination, 'repo')
revision = 'HEAD' if revision =~ /head/i
cached_upate = [
"cd #{destination}",
set :git_reuse_repo, true
class Vlad::Git
def checkout(revision, destination)
destination = File.join(destination, 'repo')
revision = 'HEAD' if revision =~ /head/i
cached_upate = [
"cd #{destination}",
"#{git_cmd} fetch origin",
Factory.sequence :login do |n|
Rufus::Mnemo::from_integer 20000+n*10000+rand(10000)
end
Factory.define :user do |u|
u.login {Factory.next :login}
u.email {|n| [n.login, "@hypermail.com"].join}
u.nick { Faker::Internet.user_name }
u.homepage { Faker::Internet::url}
u.password "111111"
@gumayunov
gumayunov / gist:176164
Created August 27, 2009 07:45
:Find CUser ./lib
function! s:FindEmAll(needle, path)
cgetexpr system('find '.a:path.' -type f -not \( -iname "*.swp" -or -iname "*.jpg" -or -iname "*.png" -or -iname "*.gif" -or -iname "*.log" \) -print0 \| xargs -0 egrep -n "'.a:needle.'" \| sed -e "s/:(\d+)/\|$1\|/"' )
copen
wincmd L
endfunction
command! -complete=file -nargs=+ Find call s:FindEmAll(<f-args>)
Organizational Principles of CSS and JS in Rails
=== Framework requirements
1. Modularity
2. Complex components are built from simple, atomic components
3. Cross-browser compatibility
a. Follow W3C standards
b. Keep IE hacks in a separate style file
4. Bulletproof
*************************** 6. row ***************************
umeta_id: 1916457
user_id: 7293
meta_key: first_name
meta_value: ...
<b id="user_superuser"><script language="JavaScript">
mysql> select option_id, option_name, length(option_value) from wp_options where option_value like '%base64_decode%'\G
*************************** 1. row ***************************
option_id: 67
option_name: rss_867bd5c64f85878d03a060509cd2f92c
length(option_value): 336349
1 row in set (0.02 sec)
@gumayunov
gumayunov / gist:184397
Created September 10, 2009 07:40
DSL block example
#lib
class DSLAble
def with_dsl(&block)
if block.arity == 1
block.call(self)
else
instance_eval(&block)
end
end