Skip to content

Instantly share code, notes, and snippets.

@aNNiMON
aNNiMON / VkApi.java
Last active March 9, 2023 20:38
VK API sample implementation for Java 8
import java.awt.Desktop;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
@aNNiMON
aNNiMON / Lang.class.php
Last active August 29, 2015 14:03
Php multlang support
<?php
/**
* Класс работы с мультиязычностью.
*
* @author aNNiMON, web_demon
*/
final class Lang {
const PATH = 'lang/';
@aNNiMON
aNNiMON / JoinImage.java
Created September 26, 2014 07:36
Join Images by ARGB-array
private BufferedImage joinHorizontally(BufferedImage[] img) {
// Считаем ширину всех картинок
int width = img[0].getWidth() * img.length;
//int width = 0;
//for (int i = 0; i < img.length; i++) width += img[i].getWidth();
// Создаём массив ARGB для полной картинки
final int[] all = new int[width*img[0].getHeight()];
for (int i = 0; i < img.length; i++) {
// Получаем пиксели очередной картинки
@aNNiMON
aNNiMON / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../topeka-elements/avatars.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../code-mirror/code-mirror.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
@aNNiMON
aNNiMON / asyncRequest.js
Last active April 23, 2017 13:46
AJAX with memoization
//
// Author: Dustin Diaz
// http://dustindiaz.com/faster-ajax/
//
var asyncRequest = function() {
function handleReadyState(o, callback, fallback) {
if (!o || o.readyState != 4) return;
if (o.status == 200) {
if (callback) {
callback(o);
@aNNiMON
aNNiMON / 1_EasyRss.md
Last active April 12, 2017 13:25
Small library to create rss feed

Usage

require_once './EasyRss.class.php';

$rss = EasyRss::create()->
    title('GitHub')->
    link('http://github.com/')->
    description('GitHub is the best place to build software together. Over 4 million people use GitHub to share code.')->
    pubDateByTimestamp(time())->
 category('IT')-&gt;
<?php
/**
* Simple template engine
*/
class Template {
private static $templatesPath = 'templates/';
private static $cache = array();
@aNNiMON
aNNiMON / listvkaudios.js
Last active December 2, 2015 11:01
List vk audios on page
function saveFile(filename, data) {
var blob = new Blob([data], {type:'text/plain'});
var saveLink = document.createElement("a");
saveLink.download = filename;
saveLink.innerHTML = "Save file";
if (window.webkitURL != null) {
saveLink.href = window.webkitURL.createObjectURL(blob);
} else {
saveLink.href = window.URL.createObjectURL(blob);
saveLink.onclick = destroyClickedElement;
@aNNiMON
aNNiMON / exua-links.js
Last active January 27, 2016 19:06
ex.ua video links extractor
@aNNiMON
aNNiMON / vk_audiolinks_new.js
Created April 1, 2016 12:52
Сохраняет ссылки на вк аудио в текстовый файл