Skip to content

Instantly share code, notes, and snippets.

@omernaci
omernaci / style.css
Created January 30, 2019 10:12
JSF HTML Generate Id with column : CSS Selector
/*
The : is a special character in CSS identifiers,
it represents the start of a pseudo class selector like :hover, :first-child, etc. You would need to escape it.
*/
#phoneForm\:phoneTable {
background: pink;
}
@omernaci
omernaci / web.xml
Created December 7, 2018 13:17
JSF DateTimeConverter Default Timezone
...
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
...
@omernaci
omernaci / number-validate.js
Created November 21, 2018 04:38
Jquery Number Validation only Allow Ctrl + V,C,S,X
$('#theField').on('keypress input', function() {
var value = $(this).val();
value = value.replace(/\D+/, ''); // removes any non-number char
$(this).val(value);
})
@omernaci
omernaci / AndroidManifest.xml
Created November 10, 2018 20:38 — forked from takeshiyako2/AndroidManifest.xml
Android Volley Sample
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.yako.volleyinstalltest" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
@omernaci
omernaci / onkeypress.html
Last active August 15, 2018 11:18
onkeypress number input with backspace
...
<input
onkeypress="if(event.which != 8 &amp;&amp; (event.which &lt; 48 || event.which &gt; 57)) return false;" />
...
/*
http://www.elizabethcastro.com/html/extras/entities.html
Entities for characters with special meaning in HTML and XHTML
*/
@omernaci
omernaci / index.html
Created August 15, 2018 08:23
call a function with arguments
<!DOCTYPE html>
<html>
<body>
<p>Click "Try it" to call a function with arguments</p>
<button onclick="myFunction('Harry Potter','Wizard')">Try it</button>
<p id="demo"></p>
...
public class CharacterEncodingFilter implements Filter {
public void init(FilterConfig config) throw ServletException {
}
public void doFilter(ServletRequest request, ServletResponse, FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
@omernaci
omernaci / index.js
Last active August 15, 2018 11:15
JQuery Number Input First Character Disable Zero
...
<input onfocus="disableFirstCharZero('inputId')"></input>
...
function disableFirstCharZero(elementId) {
$ ('#' + elementId).on( 'input propertychange paste', function(e) {
var reg = /^0+/gi;
if ( this.value.match(reg) ) {
this.value = this.value.replace(reg, '');
@omernaci
omernaci / ProxyConfig.java
Created August 2, 2018 12:33
Apache HttpComponents Proxy Config(v4.5.5)
try (ClosableHttpClient httpClient = HttpClients.createDefault()) {
HttpHost proxy = new HttpHost("proxy host", 3128);
RequestConfig config = RequestConfig.custom()
.setProxy(proxy)
.build();
HttpGet httpget = new HttpGet("/path");
httpget.setConfig(config);