This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MetricSystem | |
def self.convert(from, to, value) | |
raise ArgumentError if from.blank? || to.blank? || value.blank? | |
from = from.to_sym | |
to = to.to_sym | |
if from == :kg && to == :g | |
value.to_f * 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MetricSystem | |
def self.convert(from, to, value) | |
raise ArgumentError if from.blank? || to.blank? || value.blank? | |
from = from.to_sym | |
to = to.to_sym | |
if from == :kg && to == :g | |
value.to_f * 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<estates> | |
<estate> | |
<id>1</id> | |
<title>N Maplewood Ave, Chicago IL</title> | |
<city_title>Chicago</city_title> | |
<state_title>IL</state_title> | |
<price>1234567</price> | |
<square>3500</square> | |
<beds>3</beds> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$() // Always use jQuery | |
jQuery.noConflict(); | |
jQuery // Always returns an array | |
//Making chains methods | |
jQuery("#container div.gallery").addClass('active').removeClass('hidden').css({ backgroundColor:"yellow" }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
job = Delayed::Job.last | |
assert_equal(Delayed::PerformableMethod, job.payload_object.class) | |
assert_equal("AR:User:#{@user.id}", job.payload_object.object) | |
assert_equal(:my_method, job.payload_object.method) | |
assert_equal([1,2,3], job.payload_object.args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'net/https' | |
http = Net::HTTP.new('usubov.com', 443) | |
http.use_ssl = true | |
path = '/messages' | |
data = "user_id=1234567890" | |
headers = { | |
"Content-Type" => "text/html; charset=ISO-8859-4" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem list | cut -d" " -f1 | xargs gem uninstall -aIx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.co checkout | |
git config --global alias.br branch | |
git config --global alias.ci commit | |
git config --global alias.st status | |
git config --global alias.unstage 'reset HEAD --' | |
git config --global alias.last 'log -1 HEAD' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
class Convertor | |
def initialize(text) | |
@text = text | |
end | |
def prepare | |
response = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//jQuery | |
$('a[data-popup]').live('click', function(e) { | |
window.open($(this).href); | |
e.preventDefault(); | |
}); | |
//Prototype.js | |
document.on("click", "a[data-popup]", function(event, element) { | |
if (event.stopped) return; | |
window.open($(element).href); |
OlderNewer