Skip to content

Instantly share code, notes, and snippets.

View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@Axxiss
Axxiss / AsyncTester.java
Last active Jun 2, 2016
Testing AsyncHttpClient with Robolectric
View AsyncTester.java
public class AsyncTester {
protected static final int HTTP_OK = 200;
protected ApiCallback mCallback;
private ProtocolVersion mHttpVersion;
protected AsyncHttpClient mHttpClient = new AsyncHttpClient();
@Axxiss
Axxiss / hibernate-maven.xml
Last active Dec 22, 2015
Adding Hibernate to a Maven project.
View hibernate-maven.xml
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
View FeatureContext.php
class FeatureContext extends MinkContext
implements KernelAwareInterface
{
private $kernel;
private $parameters;
/**
* Initializes context with parameters from behat.yml.
*
* @param array $parameters
View behat.yml
default:
paths:
features: src/Acme/MyBundle/Features
bootstrap: %behat.paths.features%/bootstrap
extensions:
Behat\Symfony2Extension\Extension:
mink_driver: true
kernel:
env: test
debug: true
View calculadora.feature
Given I have a calculator
When I add 2 and 2
Then the result should be 4
Given I have a calculator
When I add 2 and -2
Then the result should be 0
Given I have a calculator
When I add -2 and -2
View testsuma.java
public void testSuma() {
assertEqualas(4, Calculadora.suma(2, 2));
assertEqualas(0, Calculadora.suma(2, -2));
assertEqualas(-4, Calculadora.suma(-2, -2));
}
@Axxiss
Axxiss / MyActivity.java
Created Mar 9, 2013
Injection on Activity
View MyActivity.java
@Inject TelephonyManager mTelephonyManager
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((FinderApplication) getApplication()).getGraph().inject(this);
}
@Axxiss
Axxiss / ServiceModule.java
Last active Dec 14, 2015
Module for system services injection
View ServiceModule.java
@Module(
entryPoints = {
MyApplication.class,
}
)
public class ServiceModule {
private Context mContext;
public ServiceModule(Context context) {
@Axxiss
Axxiss / MyApplication.java
Last active Dec 14, 2015
Daggers integration
View MyApplication.java
public class MyApplication extends Application {
private ObjectGraph mObjectGraph;
@Override
public final void onCreate() {
super.onCreate();
mObjectGraph = ObjectGraph.create(new ServiceModule(this));
}
You can’t perform that action at this time.