Skip to content

Instantly share code, notes, and snippets.

View IPRIT's full-sized avatar
💅

Alexander Belov IPRIT

💅
View GitHub Profile
@zhukov
zhukov / gist:1934001
Created February 28, 2012 17:58
VK compose photos
public void processThumbs(int maxW, int maxH){
ArrayList<ThumbAttachment> thumbs=new ArrayList<ThumbAttachment>();
for(Attachment att:attachments)
if(att instanceof PhotoAttachment) thumbs.add((ThumbAttachment)att);
String orients="";
int[] orients_cnt=new int[3];
ArrayList<Float> ratios=new ArrayList<Float>();
int cnt=thumbs.size();
boolean bad=false;
@IPRIT
IPRIT / Example
Last active August 29, 2015 14:17
using AsyncTask and Uri.Builder
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* Реализация API, не изменяйте ее
* @param {string} url
* @param {function} callback
*/
function getData(url, callback) {
var RESPONSES = {
'/countries': [
{name: 'Cameroon', continent: 'Africa'},
{name :'Fiji Islands', continent: 'Oceania'},
@function str-last-index($string, $substr) {
$index: null;
$length: str-length($string);
@for $n from $length through 1 {
$index: str-index(str-slice($string, $n, $length), $substr);
@if $index { @return $index + $n - 1; }
}
@return $index;
}