Skip to content

Instantly share code, notes, and snippets.

View worker8's full-sized avatar
:octocat:
code is compiling...

Tan Jun Rong worker8

:octocat:
code is compiling...
View GitHub Profile
@worker8
worker8 / method2.rb
Created October 16, 2012 07:08
method2.rb
def argument_check_correct(code)
code.call("a1","a2")
end
def argument_check_wrong(code)
code.call("a1")
end
def func (a1,a2)
puts "method(:func): arguments received: #{a1}, #{a2.class}"
require 'spec_helper'
# fake class
class ImageFake
end
describe "Image helper" do
@sizes = [[300,400], [500,600], [700,800]]
@worker8
worker8 / AddressBook
Created March 16, 2014 08:03
Example of traversing linked list
#include <iostream>
#include <string>
using namespace std;
class Address {}; //empty class about address
class Date{}; //to capture the date
class Person {
private:
@worker8
worker8 / FrameLayoutWithHole.java
Last active November 23, 2018 10:44
FrameLayout with a hole punched, intended to be used for tutorial screens. The punched hole is for highlighting the View to be pressed.
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
@worker8
worker8 / PriceConfirmationTask.java
Created April 1, 2015 02:52
Example of POST method to call webservice with Volley
public class PriceConfirmationTask {
private Callback mCallback;
String mDeliveryTime;
Activity mActivity;
public interface Callback{
public void onResponse(PriceCheckResult result);
}
public PriceConfirmationTask(Activity activity, String deliveryTime, Callback callback) {
mActivity = activity;
@worker8
worker8 / android_notes_#status_bar.md
Last active November 25, 2015 08:49
Android Note #status_bar
if(viewToMeasure.getViewTreeObserver().isAlive()) {
        viewToMeasure.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                if(viewToMeasure.getViewTreeObserver().isAlive()) {
                    // only need to calculate once, so remove listener
                    viewToMeasure.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                }
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.LightingColorFilter;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.view.View;
import android.widget.ImageView;