Skip to content

Instantly share code, notes, and snippets.

View bashizip's full-sized avatar
🌍

Patrick Bashizi bashizip

🌍
View GitHub Profile
@anjackson
anjackson / SwingFXWebView.java
Created January 19, 2012 15:41
Embedding a JavaFX WebView in a Swing panel.
import com.sun.javafx.application.PlatformImpl;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Node;
@arahaya
arahaya / FeedFinder.java
Created May 1, 2012 19:22
[Java][Jsoup] Extract feed urls from HTML document
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
@ozkansari
ozkansari / AtmDisplay.java
Created June 6, 2012 12:53
Atm Status Finite State Machine Example using Apache Commons SCXML Library
package net.javafun.example.atmstatusfsm;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
@JakeWharton
JakeWharton / BindingAdapter.java
Last active July 25, 2023 05:49
An adapter base class that uses a new/bind pattern for its views.
// Apache 2.0 licensed.
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/** An implementation of {@link BaseAdapter} which uses the new/bind pattern for its views. */
public abstract class BindableAdapter<T> extends BaseAdapter {
@garbados
garbados / custom.js
Last active January 25, 2018 07:58
Sample CouchDB map functions for working with dates without a library.
function(doc){
// handle a custom format using methods in the date object
var format = "{getFullYear}/{getMonth}/{getDate}",
date = new Date(doc.created_at),
// use a regular expression to replace parts of our format string
formatted_date = format.replace(/\{(\w+)\}/g, function(str, func){
var time = date[func]();
// if `func` is `getMonth` we must offset by one
if(func === 'getMonth'){
time += 1;
@artem-zinnatullin
artem-zinnatullin / MyApp.java
Last active January 15, 2023 13:04
If you need to set one font for all TextViews in android application you can use this solution. It will override ALL TextView's typefaces, includes action bar and other standard components, but EditText's password font won't be overriden.
public class MyApp extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
@gitaarik
gitaarik / git_submodules.md
Last active July 23, 2024 12:21
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 23, 2024 09:14
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@rponte
rponte / some_links.md
Last active January 19, 2022 07:48
Some interesting articles about JPA/Hibernate Multi-Tenancy
@bashizip
bashizip / gist:9d87d9edb59a5bfe405c
Last active August 29, 2015 14:05
Kannel Acces Logs Parser , Writes outputs to CSV ( Excel ) File
package kannellogsparser;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.StringTokenizer;
/**