Skip to content

Instantly share code, notes, and snippets.

View vickychijwani's full-sized avatar

Vicky Chijwani vickychijwani

View GitHub Profile
@colthreepv
colthreepv / Dockerfile
Last active February 6, 2020 06:55
Concourse CI inside Docker compose v2
FROM alpine:latest
RUN apk update && apk upgrade && \
apk add --no-cache \
openssh
RUN mkdir -p /keys/web /keys/worker
CMD ssh-keygen -t rsa -f /keys/web/tsa_host_key -N '' && \
ssh-keygen -t rsa -f /keys/web/session_signing_key -N '' && \
@romainpiel
romainpiel / MyTest.java
Last active August 13, 2019 08:31
Source for https://medium.com/p/3f6f4179652e - "RecyclerView and espresso, a complicated story"
RecyclerViewInteraction.<Item>onRecyclerView(withId(R.id.recyclerview))
.withItems(items)
.check(new ItemViewAssertion<Item>() {
@Override
public void check(Item item, View view, NoMatchingViewException e) {
matches(hasDescendant(withText(item.getDisplayName())))
.check(view, e);
}
});
@MariusBudin-zz
MariusBudin-zz / BaseFragment.java
Created May 28, 2015 14:24
A sample of how to perform post delayed calls using rxJava/rxAndroid avoiding the need to store an instance of a handler and cancel it in the onDestroy for each `postDelayed` call to avoid memory leaks
package com.ics.rxsamples
import android.app.Fragment;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.subjects.PublishSubject;
@imminent
imminent / ExampleActivity.java
Last active October 23, 2017 07:39
Gist for a modified approach to integrating Palette with Picasso proposed by Jake Wharton for the interim while Picasso doesn't have a supported way to pass meta data along the pipeline. http://jakewharton.com/coercing-picasso-to-play-with-palette/
package your.package;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.graphics.Palette;
import com.squareup.picasso.Picasso;
import your.package.PaletteTransformation;
import static your.package.PaletteTransformation.PaletteCallback;
@traviskaufman
traviskaufman / jasmine-this-vars.md
Last active September 19, 2022 14:35
Better Jasmine Tests With `this`

Better Jasmine Tests With this

On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this object, and we've seen some awesome benefits from doing such.

The old way

Up until recently, a typical unit test for us looked something like this:

describe('views.Card', function() {
@jpardogo
jpardogo / ScaleToFitWHTransformation.java
Last active June 11, 2020 08:09
Resize a bitmap respecting the aspect radio. I use a custom transformations with Picasso library. This transformation calculate the new dimension of the bitmap scaling it to fit a specific width or height that we pass as a parameter (usually the biggest size of the imageView where we wanna set the bitmap).
public class ScaleToFitWidthHeightTransform implements Transformation {
private int mSize;
private boolean isHeightScale;
public ScaleToFitWidthHeightTransform(int size, boolean isHeightScale){
mSize =size;
this.isHeightScale = isHeightScale;
}