Skip to content

Instantly share code, notes, and snippets.

@marwinxxii
marwinxxii / image.jsp
Created April 4, 2012 16:49
SVG image as JSF page
<?xml version="1.0" standalone="no"?>
<%@page contentType="image/svg+xml" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="300" height="300" xmlns="http://www.w3.org/2000/svg" version="1.1">
<path fill="#3399FF"
d="M150,150 L50,150 L50,50 L150,50 L200,150 L250,150
A100,100 0 0,1 150,250"/>
//imports
//webchromeclient for input type=file with file selector
public class CustomWebChromeClient extends WebChromeClient {
@SuppressWarnings("unused")
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "Choose image"), 1);
public class MyCustomView extends View {
/**
* Constructor intended for programmatic instantiation of view
*/
public MyCustomView(Context context) {
super(context);
initView();// onFinishInflate is not invoked
}
/**
@marwinxxii
marwinxxii / js-sequence-diagram.html
Created September 7, 2014 22:41
Self-rendering, interactive js-sequence-diagrams template.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="http://yastatic.net/raphael/2.1.0/raphael.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sequence-diagrams/1.0.4/sequence-diagram-min.js"></script>
<style type="text/css">
.text {
@marwinxxii
marwinxxii / Main.java
Created September 1, 2015 22:00
Fibonacci
package com.agapitov;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static final int MAX_INDEX_VALUE = 100000000;
public static final int MAX_INDEX_STR_LENGTH = 10;
@marwinxxii
marwinxxii / SeparateBusSample.java
Created November 23, 2015 18:32
RxJava generic event bus sample
package com.github.marwinxxii.rxsamples;
import rx.Observable;
import rx.subjects.PublishSubject;
import rx.subjects.Subject;
public class SeparateBusSample {
public static void test() {
EventBus<String> stringEventBus = new EventBus<>();
EventBus<Long> longEventBus = new EventBus<>();
@marwinxxii
marwinxxii / KActivity.kt
Created February 17, 2016 22:21
RxRetain
package com.marwinxxii.rxretain
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.Toast
import rx.Observable
import rx.android.schedulers.AndroidSchedulers
import java.util.*
import java.util.concurrent.TimeUnit
body {
width: 280px;
margin: 0;
padding: 0;
}
.shooter-1 {
padding: 55px 0 55px 0;
background-color: #fcf8e3;