Skip to content

Instantly share code, notes, and snippets.

@royshil
royshil / GLWidgetOpenGL4Example.cpp
Last active July 17, 2019 01:38
Simple example of OpenGL 4.1 in a QGLWidget
/*
* GLWidgetOpenGL4Example.h
*
* Created on: Apr 23, 2016
* Author: roy_shilkrot
*
*/
class GLWidgetOpenGL4Example : public QGLWidget {
public:

Adding a Certificate to a Key Store

// This method adds a certificate with the specified alias to the specified keystore file.
public static void addToKeyStore(File keystoreFile, char[] keystorePassword,
  String alias, java.security.cert.Certificate cert) {
    try {
        // Create an empty keystore object
        KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());

// Load the keystore contents

@briangriffey
briangriffey / NinePatchBitmapFactory.java
Last active April 25, 2023 03:06
Create 9-patches simlar to - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.NinePatch;
import android.graphics.Rect;
import android.graphics.drawable.NinePatchDrawable;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
@colabug
colabug / ActivityStart.java
Created July 23, 2012 20:03
Chariot Blog Android Unit Testing With Robolectric
@Test
public void buttonClickShouldStartNewActivity() throws Exception
{
Button button = activity.findViewById( R.id.next_screen_button );
button.performClick();
Intent intent = NewActivity.createIntent( activity );
assertThat( activity, new StartedMatcher( intent ) );
}