Skip to content

Instantly share code, notes, and snippets.

@vovka
vovka / able to merge.png
Last active August 29, 2015 14:02
PR instruction
able to merge.png
# Rack env specification:
# http://rack.rubyforge.org/doc/SPEC.html
# https://github.com/rack/rack/blob/master/SPEC
# How to get fake env hash:
# http://rack.rubyforge.org/doc/Rack/MockRequest.html#env_for-method
env = Rack::MockRequest.env_for('/test')
# Devise with Warden
@vovka
vovka / gist:6806363
Last active December 28, 2016 11:38
VK auto liker
var h=document.getElementsByClassName('post_like_icon'),u=[],i;for(i=0;i<h.length;i++){if(!h[i].className.match('my_like'))u.push(h[i])};console.log('unliked amount '+u.length);i=-1;function l(){i++;if(i<u.length){u[i].click();console.log('liked'+u[i]);setTimeout(l,1000)}};l()
<script type='text/javascript'>
$(function() { $('head base').attr('href', window.location.href) });
</script>
# Есть такая функция:
def code_unique? klass, msg_assignment_proc=Proc.new
if @@error_classes.empty?
true
else
if @@error_classes.map(&:new).map(&:code).include?(klass.new.code)
msg_assignment_proc.call "Error code value repeating: #{klass.new.code}"
false
else
true
class A
attr_accessor :b
end
class B
attr_accessor :val
end
a = A.new
b = B.new