Skip to content

Instantly share code, notes, and snippets.

@herdianf
herdianf / clean_apache_config.sh
Created November 5, 2016 15:21
Cleanup Apache Config Comments
sed -i -e 's/#.*$//' -e '/^\s*$/d' /etc/httpd/conf/httpd.conf
@herdianf
herdianf / cxense.html
Created December 6, 2016 03:09
Cxense Embed Code
<div id="cxense-div"></div>
<script>
var cX = cX || {};
cX.callQueue = cX.callQueue || [];
cX.callQueue.push(['insertWidget', {
widgetId: '4f6a036c13e80cb204ed1a02ad91e6bda0ad2ed3',
renderFunction: function(data, context) {
var items = data.response.items;
if (items.length > 0) {
var numLimit = 4;
@herdianf
herdianf / carousel.html
Created February 2, 2017 16:38
Carousel Video HTML
var addEvent(elem, event, fn) {
if (elem.addEventListener) {
elem.addEventListener(event, fn, false);
} else {
elem.attachEvent("on" + event, function() {
return (fn.call(elem, window.event));
});
}
},
urlparser = document.createElement('a'),
<div class="videoWrapper skrin-embed"
id="native-video-1"
data-url="https://skrin.id/watch/14j6ur6tm7ka?ec=Reguler-Vemale&el=&autoplay=0&utm_source=vemale.com-mobile&utm_medium=skrin&utm_campaign=Reguler-Vemale&ref=null" data-debug="true" data-lazy="true">
</div>
<div class="videoWrapper skrin-embed"
id="native_video_2"
data-url="http://dev.skrin.id/watch/14ev4ozxyuze?reload=1&ec=Reguler-Vemale&el=&autoplay=0&utm_source=vemale.com-mobile&utm_medium=skrin&utm_campaign=Reguler-Vemale&ref=null" data-debug="true" data-lazy="true">
</div>
@herdianf
herdianf / jetty-maven-plugin-pom.xml
Created February 10, 2017 19:24
disable jetty-maven-plugin jsessionid
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${version.jetty}</version>
<configuration>
<webAppConfig>
<contextPath>/foo</contextPath>
function SuccessUID(UID)
{
var d = new Date();
d.setTime(d.getTime() + (365 * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = "UID=" + UID + "; " + expires + "; domain=.vizpro.sg; path=/";
cX.callQueue.push(['invoke', function () { // This is called when CX is ready, no need for callQueue.push after this.
if (UID != "" && UID != "null" && UID != "true" && UID != "false" && UID != "error" && UID != "undefined" && UID.length > 5)
{
<?xml version="1.0" encoding="UTF-8"?><newsMessage xmlns="http://iptc.org/std/nar/2006-10-01/" xmlns:rtr="http://www.reuters.com/ns/2003/08/content" xmlns:x="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<header>
<sent>2017-03-06T00:59:40.000Z</sent>
<sender>reuters.com</sender>
<transmitId>tag:reuters.com,2017:newsml_KBN16D033:1</transmitId>
<priority>4</priority>
<destination>OUSTPM</destination>
<destination>RTRFLN</destination>
<destination>OUS12</destination>
<destination>OUSBSM</destination>
@herdianf
herdianf / cnaagent.js
Created June 8, 2017 07:00
cnaagent.js
window.initVideoTracking = function(player) {
window.gfkSsaConf = {
"media": "",
"url": "//sg-config.sensic.net/sg1-ssa-w.js"
};
(function(w, d, c, s, id) {
if (d.getElementById(id)) {
return;
}
@herdianf
herdianf / ciaclient.java
Created June 9, 2017 05:45
Cia Deduplication
private Map<String, Object> processResponse(Map<String, Object> map,
final String payload) {
//noinspection unchecked
final List<Map<String, Object>> namedEntities = (List<Map<String, Object>>) map.remove("namedEntities");
final List<Map<String, Object>> semanticKeywords = (List<Map<String, Object>>) map.remove("semanticKeywords");
final List<Map<String, Object>> taxonomies = (List<Map<String, Object>>) map.remove("taxonomy");
//filter duplicates
List<Map<String,Object>> entities = new ArrayList<Map<String, Object>>();
Map<String,Object> keys = new HashMap<String, Object>();