Skip to content

Instantly share code, notes, and snippets.

View adis-io's full-sized avatar

Adis Osmonov adis-io

View GitHub Profile
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://image.torrent.kg/images/U8x5261.png', false);
xhr.responseType = 'arraybuffer';
xhr.send();
var blob = new WebKitBlobBuilder();
blob.append(xhr.response);
var file = blob.getBlob('image/png');
console.log(file)
var fd = new FormData();
fd.append("image[0]", file);
@adis-io
adis-io / uploader.js
Created November 26, 2011 16:05
ASYNC
function upload(image){
var xhr = new XMLHttpRequest();
xhr.open('GET', image.srcUrl, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
if (this.status == 200) {
var mime = xhr.getResponseHeader('Content-type');
var blob = new WebKitBlobBuilder();
blob.append(xhr.response);
var file = blob.getBlob(mime);
@adis-io
adis-io / uploader.js
Created November 26, 2011 16:07
SYNC
function upload(image){
var xhr = new XMLHttpRequest();
xhr.open('GET', image.srcUrl, false);
xhr.responseType = 'arraybuffer';
xhr.send();
var mime = xhr.getResponseHeader('Content-type');
var blob = new WebKitBlobBuilder();
blob.append(xhr.response);
var file = blob.getBlob(mime);
var fd = new FormData();
@adis-io
adis-io / perviy.js
Created March 25, 2012 18:26
perviy
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://diesel.elcat.kg/index.php?showtopic=10954635', true);
xhr.onload = function(e) {
if (this.status == 200) {
console.log(xhr.response);
}
};
xhr.send();
@adis-io
adis-io / domparser.js
Created March 29, 2012 14:26
dom parser
/*
* DOMParser HTML extension
* 2012-02-02
*
* By Eli Grey, http://eligrey.com
* Public domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*! @source https://gist.github.com/1129031 */
draw 0
Error! no function named mediaLibState
[Script] img img img home_menu/image/UI_Main_RedBar.fsp
Error! no function named mediaLibState
draw 1
Error! no function named mediaLibState
draw 2
Error! no function named mediaLibState
draw 3
syntax error
@adis-io
adis-io / prsha.php
Created June 25, 2012 13:11
prosha.php
<?
/*
* Bast Castle firmware (YouTube Processor)
*
* Copyright (c) 2012, Sekator500 <sekator500@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@adis-io
adis-io / shadow_irrp.dat
Created June 25, 2012 17:44
Eaget M7 remote code
"0","f708bd00","e51ab649","power"
"0","ad52bd00","e41bb649","home"
"0","fe01bd00","ad52b649","mute"
"0","bb44bd00","bb44b649","display"
"0","f50abd00","af50b649","setup"
"0","ef10bd00","b04fb649","vol-"
"0","f30cbd00","ae51b649","vol+"
"0","b649bd00","ed12b649","left"
"0","f40bbd00","b54ab649","up"
"0","b54abd00","b44bb649","right"
@adis-io
adis-io / debug-bar.js
Created August 20, 2012 12:54
Debug Bar
var wpDebugBar;
(function(b) {
var a;
var vis = 'dbar_visibility';
var curtab = 'dbar_curtab';
var dbstate = 'dbar_state'
wpDebugBar = a = {
last: function() {
var index;
var state;
@adis-io
adis-io / thumb.php
Created September 18, 2012 17:39
thumb
function has_post_images($id) {
$files = get_children('post_parent='.$id.'&post_type=attachment&post_mime_type=image&order=desc');
return $files;
}
function get_the_post_image($id, $width, $height) {
if ( has_post_images($id) ) :
$files = has_post_images($id);
$keys = array_reverse(array_keys($files));
$j = 0;