Skip to content

Instantly share code, notes, and snippets.

@thomd
thomd / java-snippets.md
Last active April 29, 2024 18:31
Java code snippets

Java Snippets

Converting Strings to int and int to String

String a = String.valueOf(2); 
int i = Integer.parseInt(a);  

Convert String to Date

#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
#EXTINF:-1,BBC - Radio 2
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
#EXTINF:-1,BBC - Radio 3
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls
#EXTINF:-1,BBC - Radio 4
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
#EXTINF:-1,BBC - Radio 5 live
@consti
consti / hosts
Last active June 25, 2026 18:41
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@rxaviers
rxaviers / gist:7360908
Last active July 23, 2026 20:41
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@need4spd
need4spd / DAO.java
Last active December 16, 2017 17:34
Mockito
//Dao class
public class DAO {
public Result select(Param param) {
return sqlClient.select("id", param);
}
}
package com.test;
import java.sql.SQLException;
public final class UncheckedThrow {
public static void throwUnchecked(final Exception ex){
UncheckedThrow.<RuntimeException>throwsUnchecked(ex);
}
public static <T extends Exception> void throwsUnchecked(Exception toThrow) throws T{
@golonzovsky
golonzovsky / JaxbTest.java
Last active September 9, 2019 11:59
jaxb wrapper example for non-list elements
package com.test.ws;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@JeremyMorgan
JeremyMorgan / database.class.php
Last active December 14, 2015 17:09
Simple PDO Database Class
<?php
/**
* File: database.class.php
* Super simple PDO class
*
* Author: Jeremy Morgan
*
* This is just a start. No error handling or parameterization yet
*/
@cole007
cole007 / Influential Abums
Created January 26, 2013 17:00
List of the 100 most influential albums, as listed on http://www.influentialalbums.com
The Pretty Things - S.F. Sorrow
Ride - Nowhere
Wire - Chairs Missing
The Jesus And Mary Chain - Psychocandy
Jimi Hendrix - Axis: Bold As Love
New Order - Technique
Harry Nilsson - Nilsson Schmilsson
Mazzy Star - So Tonight That I Might See
Captain Beefheart - Trout Mask Replica
Elliott Smith - Roman Candle
@ProLoser
ProLoser / alerts.html
Last active October 9, 2019 18:38
AngularJS Bootstrap implemented without any additional code
<h1>Alert</h1>
<p>Bootstrap JS</p>
<div class="alert fade in">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
</div>
<p></p><a ng-click="alert=true">Open Alert (AngularJS)</a></p>
<div class="alert fade" ng-class="{in:alert}">
<button type="button" class="close" ng-click="alert=false">×</button>