Skip to content

Instantly share code, notes, and snippets.

View andrea-ale-sbarra's full-sized avatar
🎯
Focusing

Andrea Sbarra andrea-ale-sbarra

🎯
Focusing
View GitHub Profile
@andrea-ale-sbarra
andrea-ale-sbarra / Custom font in WebView
Last active December 8, 2021 09:29
How to add custom font in Android WebView.
//View container..
View rootView = inflater.inflate(R.layout.fragment1, container, false);
//Global WebView
mWebView = (WebView) rootView.findViewById(R.id.enter_text);
//Font must be placed in assets/fonts folder
String text = "<html><style type='text/css'>@font-face { font-family: spqr; src: url('fonts/spqr.ttf'); } body p {font-family: spqr;}</style>"
+ "<body >" + "<p align=\"justify\" style=\"font-size: 22px; font-family: spqr;\">" + getString(R.string.enter_text) + "</p> "+ "</body></html>";
@andrea-ale-sbarra
andrea-ale-sbarra / gist:f8277f49f6047ad47c57
Created April 30, 2014 07:51
Html5 support for a wordpress theme
/*
* Switches default core markup for search form, comment form,
* and comments to output valid HTML5.
*/
add_theme_support( 'html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption') );
@andrea-ale-sbarra
andrea-ale-sbarra / Sepia
Created July 9, 2014 07:27
Rgb code for sepia color
Background: 245 239 220 alpha:1.0f
Text: 63 42 24 alpha:1.0f
@andrea-ale-sbarra
andrea-ale-sbarra / NSDate extension
Created July 21, 2014 20:08
Estendere la NSDate in swift e settaggi utili
extension NSDate
{
convenience
init(dateString:String) {
let dateStringFormatter = NSDateFormatter()
dateStringFormatter.dateFormat = "yyyy-MM-dd"
dateStringFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
let d = dateStringFormatter.dateFromString(dateString)
self.init(timeInterval:0, sinceDate:d)
}
cd apache-tomcat\bin
set JPDA_SUSPEND=y
catalina.bat jpda run
@andrea-ale-sbarra
andrea-ale-sbarra / ReadProperties.java
Created May 17, 2016 13:20
read .properties from classpath
Properties prop = new Properties();
InputStream input = null;
try {
String filename = "config.properties";
input = this.getClass().getClassLoader().getResourceAsStream(filename);
if (input == null) {
System.out.println("Sorry, unable to find " + filename);
throw new java.lang.UnsupportedOperationException("Some errors occurred, please try again later.");
@andrea-ale-sbarra
andrea-ale-sbarra / keyboard configuration
Created July 15, 2016 09:16
on vagrant box run this command to configure keyboard
sudo dpkg-reconfigure keyboard-configuration
@andrea-ale-sbarra
andrea-ale-sbarra / preselect value in select tag with angular
Created August 31, 2016 07:22
I have a team instance in user and a list of teams from which I should preselect the value to show in my option.
<select ng-options="option.name for option in $ctrl.teams track by option.id" ng-model="user.team"></select>
@andrea-ale-sbarra
andrea-ale-sbarra / read topic from beginning
Last active April 6, 2017 08:06
Login to Kafka docker and read topic from beginning.
ALERT TOPIC
docker exec -it kafka bash
kafka-console-consumer --zookeeper zookeeper:2181 --topic rule-11835 --from-beginning
EMT TOPIC
docker exec -it kafka bash
kafka-console-consumer --zookeeper zookeeper:2181 --topic rule-46826 --from-beginning
@andrea-ale-sbarra
andrea-ale-sbarra / from_varchar_to_clob.sql
Created July 13, 2017 07:23
Sql script that converts one column from varchar to clob.
ALTER TABLE NP_SUSP_TRANS_REP ADD ("REASONS_REMIT_BREACH_N" CLOB NULL) LOB
(
"REASONS_REMIT_BREACH_N"
)
STORE AS
(
TABLESPACE "notif_dat" RETENTION ENABLE STORAGE IN ROW NOCACHE
);
UPDATE NP_SUSP_TRANS_REP SET "REASONS_REMIT_BREACH_N" = "REASONS_REMIT_BREACH";
-- ALTER TABLE "ARIS_STG".trs_fund_storage_unavail MODIFY ("unavailabilityDescrN" NOT NULL);