Skip to content

Instantly share code, notes, and snippets.

Christopher Ross crossphd

Block or report user

Report or block crossphd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Picasso code
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
View Picasso custom transformation example
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
import com.squareup.picasso.Transformation;
public class CircleTransform implements Transformation {
View Picasso example
Article currentArticle = getItem(position);
ImageView image = listItemView.findViewById(R.id.article_image);
if (currentArticle != null) {
Picasso.with(this.getContext())
.load(currentArticle.getmImageUrl())
.centerCrop()
.transform(new CircleTransform(50,0))
.fit()
View Start using Picasso with one line of code
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
View Add Picasso dependency with maven
<dependency>
<groupId>com.squareup.picasso</groupId>
<artifactId>picasso</artifactId>
<version>(insert latest version)</version>
</dependency>
View Add Picasso to Gradle
compile 'com.squareup.picasso:picasso:(insert latest version)'
View Loading images with AsyncTask p2
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
ImageView bmImage;
public DownloadImageTask(ImageView bmImage) {
this.bmImage = bmImage;
}
protected Bitmap doInBackground(String... urls) {
String urldisplay = urls[0];
Bitmap bmp = null;
try {
View Loading images with AsyncTask p1
Article currentArticle = getItem(position);
ImageView image = listItemView.findViewById(R.id.article_image);
if (currentArticle != null) {
new DownloadImageTask(image).execute(currentArticle.getmImageUrl());
}
@crossphd
crossphd / scrape.rb
Created May 16, 2017 — forked from jescalan/scrape.rb
Ruby Amazon Scraper
View scrape.rb
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'colored'
# this is just a preview of what's to come - a proof of concept.
# it will be converted to a api-type library, gemified, and put in it's own repo
# for now, a cool way to experiment with amazon's data
query = 'ruby'
View amazon_review_scraper.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Written as part of https://www.scrapehero.com/how-to-scrape-amazon-product-reviews-using-python/
from lxml import html
import json
import requests
import json,re
from dateutil import parser as dateparser
from time import sleep
You can’t perform that action at this time.