Skip to content

Instantly share code, notes, and snippets.

View eugeneglova's full-sized avatar

Eugene Glova eugeneglova

View GitHub Profile
/**
* isFiles
*
* Returns true if user tries to drag or drop files
*
* @param {jQuery Event} e
* @return {Boolean}
*/
isFiles: function(e) {
if ( ! is(e, 'object')) return false;
@eugeneglova
eugeneglova / html2canvas-proxy.php
Last active December 30, 2015 07:29
html2canvas php proxy
<?php
/**
* html2canvas proxy script
*
* Provides proxy service for html2canvas.js lib.
* Responsible for output javascript callback with image url
* to provide work around for the same origin limitation.
*
* Used to ensure that project images are included in the export PNGs,
@eugeneglova
eugeneglova / encryption.js
Last active December 21, 2015 12:19
trying to make public and private key based on http://www.youtube.com/watch?v=3QnD2c4Xovk
function enc(exp, private) {
return Math.pow(exp, private) % 17;
}
function calc(pub1, private1, private2) {
var a, b;
a = enc(pub1, private1);
b = enc(pub1, private2);
return enc(b, private1) === enc(a, private2);
}
@eugeneglova
eugeneglova / proxy.php
Last active December 21, 2015 01:09
php curl proxy
<?php
/**
* proxy.php
*
* Responsible to get data from remote domain
*
* mod_rewrite configuration for .htaccess file
*
* RewriteEngine on
<?php
// How to replace middle part of the word
// Array of words
$array = array('what', 'aaa', 'hellokity');
// Function to return replaced value
// Accept value as a string and
// replacer as a character to replace each char in middle part of the word
@eugeneglova
eugeneglova / myPHPProgrammingSkillsTest.php
Created April 5, 2013 17:42
my version of oDesk PHP Programming Skills Test
<?php
// 1
$_POST['checkbox_2'] = true;
$_POST['checkbox_1'] = true;
$_POST['checkbox_3'] = true;
for ($_POST as $key => $val) {
if (preg_match('/checkbox_(\d+)/', $key, $matches)) {