This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String getBaseUrl(HttpServletRequest request) { | |
String baseUrl = request.getRequestURL().substring(0, request.getRequestURL().length() - request.getRequestURI().length()) + request.getContextPath(); | |
return baseUrl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String paypalApiUrl = "https://api-3t.sandbox.paypal.com/nvp"; // remove sandbox. for production environment | |
private static NumberFormat paypalNumberFormat = new DecimalFormat("0.00", new DecimalFormatSymbols(Locale.US)); | |
public Map<String, String> paypalApi(Map<String, Object> params) throws ClientProtocolException, IOException { | |
HttpClient client = httpClientBuilder.build(); | |
HttpPost post = new HttpPost(paypalApiUrl); | |
List<NameValuePair> nvpParams = new ArrayList<NameValuePair>(); | |
for (Map.Entry<String, ?> e : params.entrySet()) { | |
nvpParams.add(new BasicNameValuePair(e.getKey(), e.getValue() instanceof Number | |
? paypalNumberFormat.format(e.getKey()) : e.getValue().toString())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select > | |
<option th:each="year : ${#numbers.sequence(1900, #dates.year(#dates.createNow()))}" | |
th:value="${year}" th:text="${year}"> | |
</option> | |
</select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout gh-pages | |
git merge master | |
git push origin gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set a proxy | |
set HTTP_PROXY= | |
set HTTPS_PROXY=%HTTP_PROXY% | |
npm config set proxy %HTTP_PROXY% | |
npm config set https.proxy %HTTPS_PROXY% | |
npm config set https-proxy %HTTPS_PROXY% | |
git config --global http.proxy %HTTP_PROXY% | |
git config --global https.proxy %HTTPS_PROXY% | |
# unset proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{url:'stun:stun01.sipphone.com'}, | |
{url:'stun:stun.ekiga.net'}, | |
{url:'stun:stun.fwdnet.net'}, | |
{url:'stun:stun.ideasip.com'}, | |
{url:'stun:stun.iptel.org'}, | |
{url:'stun:stun.rixtelecom.se'}, | |
{url:'stun:stun.schlund.de'}, | |
{url:'stun:stun.l.google.com:19302'}, | |
{url:'stun:stun1.l.google.com:19302'}, | |
{url:'stun:stun2.l.google.com:19302'}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ids = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"]; | |
if (typeof XMLHttpRequest === "undefined") { | |
for (var i = 0; i < ids.length; i++) { | |
try { | |
new ActiveXObject(ids[i]); | |
window.XMLHttpRequest = function() { | |
return new ActiveXObject(ids[i]); | |
}; | |
break; | |
} catch (e) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.bar; | |
import org.geotools.referencing.GeodeticCalculator; | |
import java.awt.geom.Point2D; | |
/** | |
* How far is NY from London ? | |
*/ | |
public class DistanceTest { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.stefisoft.webchat; | |
import java.util.HashSet; | |
import java.util.Set; | |
import javax.websocket.Endpoint; | |
import javax.websocket.server.ServerApplicationConfig; | |
import javax.websocket.server.ServerEndpointConfig; | |
import org.slf4j.Logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: node_js | |
node_js: | |
- stable | |
before_install: | |
- export CHROME_BIN=/usr/bin/google-chrome | |
- export DISPLAY=:99.0 | |
- sh -e /etc/init.d/xvfb start | |
- sudo apt-get update | |
- sudo apt-get install -y libappindicator1 fonts-liberation | |
- sudo apt-get upgrade libstdc++6 lsb-base |
OlderNewer