Skip to content

Instantly share code, notes, and snippets.

View dulichan's full-sized avatar

Dulitha Wijewantha (Chan) dulichan

View GitHub Profile
@dulichan
dulichan / gist:8311514
Created January 8, 2014 03:53
Example of using string concat for for sql queries
var buildPlatformString = function(platform){
var platform = platform.toUpperCase();
if ( platform== 'ANDROID'){
platform = 'devices.platform_id=1';
}else if (platform == 'IOS'){
platform = '(devices.platform_id=2 or devices.platform_id=3 or devices.platform_id=4)';
}
return platform;
}
var buildDynamicQuery = function(platform, type){
@dulichan
dulichan / ios-gen.sh
Created November 24, 2013 08:05
Configure the MDM using a shell script
#!/bin/bash
# Created by: Chan
# Date: 2013/11/24
PRODUCT_HOME="$1"
if [ -z "$PRODUCT_HOME" ]; then
echo "Usage: $(basename $0) <domain>"
exit 11
fi
fail_if_error() {
@dulichan
dulichan / jaggery.conf
Created October 14, 2013 17:05
Basic Jaggery.conf
{
"welcomeFiles": ["index.jag"],
"initScripts": ["config/app.js"],
"urlMappings": [
{
"url": "/login",
"path": "/login.jag"
},
{
"url": "/logout",
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.wso2.org/governance/metadata">
<LIVE>
<date>2013-08-15 10:44:42.092</date>
</LIVE>
<IN-REVIEW>
<date>2013-08-15 10:44:26.361</date>
</IN-REVIEW>
<overview>
<status>LIVE</status>
@dulichan
dulichan / gist:6171023
Last active December 20, 2015 17:49
Check the createArtifact method
(function (server, registry) {
var log = new Log();
var GenericArtifactManager = Packages.org.wso2.carbon.governance.api.generic.GenericArtifactManager;
var GenericArtifactFilter = Packages.org.wso2.carbon.governance.api.generic.GenericArtifactFilter;
var ByteArrayInputStream = Packages.java.io.ByteArrayInputStream;
var QName = Packages.javax.xml.namespace.QName;
var IOUtils = Packages.org.apache.commons.io.IOUtils;
@dulichan
dulichan / gist:6170926
Created August 7, 2013 03:24
Synchronous issue with GenericArtifactManager
am = new carbon.registry.ArtifactManager(registry, "mobileapp");
var attributes ={
overview_status: "PENDING-REVIEW",
overview_name: ctx.name,
overview_platform:t,
overview_version: ctx.version,
overview_url: ctx.url,
overview_provider: ctx.provider,
overview_description: ctx.description,
overview_market:ctx.markettype,
@dulichan
dulichan / ios_profile.hbs
Created July 21, 2013 09:33
Enterprise App Deployment for iOS plist template
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
@dulichan
dulichan / ActionHelper.java
Created March 29, 2013 04:28
Swing action component framework
/**
* Copyright (c) 2013 Dulitha Wijewantha (http://www.dulithawijewantha.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@dulichan
dulichan / AwesomeApp.scala
Created March 29, 2013 02:34
A small scala app with Swing interface that interact with MongoDB
package com.dchan.awesomebank
import scala.swing.SimpleSwingApplication
import scala.swing.MainFrame
import scala.swing.Button
import javax.swing.JPanel
import java.awt.BorderLayout
import scala.swing.FlowPanel
import scala.swing.TextField
import scala.swing.Label
@dulichan
dulichan / AsyncExecuter.java
Created March 24, 2013 18:02
Asynchronous task executer that uses an ongoing thread to monitor the tasks.
package org.dchan.concurrent;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
/**
* Copyright (c) 2013 Dulitha Wijewantha (http://www.dulithawijewantha.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy