Skip to content

Instantly share code, notes, and snippets.

View ioseb's full-sized avatar

Ioseb Dzmanashvili ioseb

View GitHub Profile
$(function() {
function isValidTarget(node) {
return /^img|canvas$/i.test(node.nodeName);
};
$('div.entry table tbody td span').mouseenter(function(e) {
var target = e.target;
if (isValidTarget(target)) {
var img = new Image();
<?php
$url = 'http://www.code.ge/uncategorized/youtube-edu-და-ბევრი-საინტერესო-მას';
$url = urldecode($url);
if (!preg_match('~^https?://~', $url)) {
$url = 'http://' . $url;
}
$parsed = parse_url($url);
@ioseb
ioseb / gist:69058
Created February 23, 2009 17:04
JavaScript array chunk function
function arrayChunk(array, size) {
var start = 0, result = [], chunk = [];
while((chunk = array.slice(start, start += size)).length) {
result.push(chunk);
}
return result;
}
package com.topcoder;
public class Bonuses {
public int[] getDivision(int[] points) {
int bonuses[] = new int[points.length];
int pool = 0, percentsLeft = 100;
for (int point : points) {
package ge.code.topcoder;
public class PowerOutage {
public int estimateTimeOut(int[] fromJunction, int[] toJunction, int[] ductLength) {
int[] sum = new int[50];
int total = 0, max = 0;
for (int i = 0; i < fromJunction.length; i++) {
package ge.code.topcoder;
public class BinaryCode {
private static final String NONE = "NONE";
private int toInt(char c) {
return Integer.parseInt(Character.toString(c));
}
package ge.code.topcoder;
import java.util.Arrays;
import java.util.Comparator;
public class Lottery {
private static final Comparator<Rule> RULE_COMPARATOR = new Comparator<Rule>() {
public int compare(Rule o1, Rule o2) {
int result = 1;
@ioseb
ioseb / gist:68221
Created February 21, 2009 23:07
JavaScript code to execute Dean Edwards packer script with Rhyno from ANT
/**
* code by Ioseb Dzmanashvili http://www.code.ge
* MIT License
*/
output = java.io.FileWriter(arguments[1]); //obtain FileWriter object
output.write(
pack( //invoke Dean Edward's packer function
readFile( //read input file: http://www.mozilla.org/rhino/shell.html
arguments[0] //input file path