This file contains hidden or 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
function doSomething() { | |
alert("I'm done resizing for the moment"); | |
}; | |
var resizeTimer; | |
$(window).resize(function() { | |
clearTimeout(resizeTimer); | |
resizeTimer = setTimeout(doSomething, 100); | |
}); |
This file contains hidden or 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
def generate_gender | |
return :M if rand(0..1) > 0 | |
return :F | |
end |
This file contains hidden or 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 "ensure" | |
class Downloader | |
# Expected encodings | |
ENCODINGS = Array['UTF-8', 'WINDOWS-1251', 'KOI-8'] | |
def get_page(url) | |
response = Net::HTTP.get_response(URI.parse(url)) | |
while response.kind_of?(Net::HTTPRedirection) |
This file contains hidden or 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
package clusterizer; | |
import java.util.ArrayList; | |
public abstract class Clusterizer { | |
protected class Pair { | |
public int x, y; // ID's of clusters | |
public Pair(int x, int y) { | |
this.x = x; |
NewerOlder