Skip to content

Instantly share code, notes, and snippets.

@cyrilmottier
cyrilmottier / gist:3788097
Created September 26, 2012 13:39
ViewPager in a ListView
private OnPageChangeListener mOnPageChangeListener = new OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
// Do whatever you wan't to do. It's up to you ... not me :)
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// Do whatever you wan't to do. It's up to you ... not me :)
}
$ hermione.py test-3.0
Deploying artifacts to hermetic repository...
Rictusempra com.aaa:bbb:1.0-test-3.0...
Prior Incantato com.ccc:ddd:1.0.0-test-3.0...
Point Me com.eee:fff:2.2-test-3.0...
Rictusempra com.ggg:hhh:0.8-test-3.0...
Engorgio com.iii:jjj:1.0-test-3.0...
Rictusempra com.kkk:lll:0.8.0-test-3.0...
@thomasbiddle
thomasbiddle / librarian-puppet-rake-task
Created October 22, 2012 23:24
Librarian-Puppet Rake Task for Templating the Puppetfile
#!/usr/bin/ruby
require 'erb'
desc "Templates the Puppetfile to the specified environment"
task :template_puppetfile, [:env] do |t, args|
unless args[:env].nil?
@environment = args[:env]
read_file = 'Puppetfile.erb'
write_file = 'Puppetfile'
@cyrilmottier
cyrilmottier / ClassA.java
Created January 10, 2013 09:16
Java puzzle: field instantiation
package com.cyrilmottier.test;
public class ClassA {
public ClassA() {
System.out.println("ClassA()");
method();
}
public void method() {
@cyrilmottier
cyrilmottier / gist:5292270
Created April 2, 2013 13:39
Passing additional information into a Cursor
package com.cyrilmottier.android.avelov.database;
import android.database.Cursor;
import android.database.CursorWrapper;
import android.os.Bundle;
/**
* A Cursor that completely re-writes the actual Cursor capabilities related to extras. It allows clients to use the setExtras(Bundle) (this
* method is actually hidden in the Android framework).
*
@jamiehuson
jamiehuson / JacksonConverter
Created September 16, 2013 21:32
A Jackson Converter for use with Square's Tape queue library
public class JacksonConverter<T> implements FileObjectQueue.Converter<T> {
private final ObjectMapper mMapper;
private final Class<T> mType;
public JacksonConverter(ObjectMapper mapper, Class<T> type) {
this.mType = type;
this.mMapper = mapper;
}
package com.asynctask.util;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import java.io.InterruptedIOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.Callable;
@JakeWharton
JakeWharton / authorpurge.py
Created August 15, 2012 19:29
Purge all @author tags!
#!/usr/bin/env python
import os
import re
os.system('git reset --hard HEAD')
os.system('git clean -fdx')
REs = [
r'''\s+\*\n\s+\* @author[^\n]*''',
@mg6maciej
mg6maciej / DisposeOnDestroy.kt
Last active April 5, 2018 08:45
disposeOnDestroy
import android.app.Activity
import android.app.Application
import android.os.Bundle
import io.reactivex.disposables.Disposable
import io.reactivex.functions.Consumer
fun Activity.disposeOnDestroy() = Consumer<Disposable> { disposable ->
application.registerActivityLifecycleCallbacks(object : Application.ActivityLifecycleCallbacks {
override fun onActivityDestroyed(activity: Activity) {
@david-mark
david-mark / gist:3279190
Created August 6, 2012 22:47
Sencha Touch Still Sucks

Was asked to look at this thing again; only reviewed the JS portion. Last I checked, the CSS was similarly reality-challenged. Graphics are nice, but are tantamount to the paint job on a used car. Under the hood, this thing is all junk. It's hard to imagine the innards of any Web or mobile device-based application would end up like this, which raises the question of whether the authors have ever written such applications (or any amount of meaningful JS).

/**
 * @class Ext
 * @singleton

There (still) are no "classes" or "singletons" in JS (starting off on the wrong foot by mangling JS terms).