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
/** | |
* Convert a Map to a JSON object. | |
* | |
* @param {Map<any, any>} map - The Map to convert to JSON. | |
* @returns {Object} The converted JSON object. | |
*/ | |
const mapToJson = (map) => { | |
let obj = Object.create(null) | |
for (let [key, val] of map) { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns="http://maven.apache.org/POM/4.0.0" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.amirkhawaja</groupId> | |
<artifactId>spring-poc</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<packaging>jar</packaging> |
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.amirkhawaja; | |
import java.nio.ByteBuffer; | |
public final class ByteUtils { | |
private ByteUtils() { | |
} | |
public static long stringToLong(String s) { |
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.amirkhawaja; | |
import java.security.SecureRandom; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
public class Utilities() { | |
private static final SecureRandom random; |
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
/** | |
* Process a set of functions in order supplied. | |
* | |
* @author Amir Khawaja <[email protected]> | |
* @param {array} funcs - An array of functions | |
*/ | |
function waterfall(funcs, done) { | |
if (funcs !== void 0 && funcs !== null) { | |
if (typeof funcs !== 'object' && funcs.shift !== void 0) { | |
throw new Error('Array of functions expected'); |
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
"use strict"; | |
/** | |
* Cross-Domain Ajax helper. | |
* @author Amir Khawaja <[email protected]> | |
* @license MIT | |
* @constructor | |
*/ | |
var XRequest = function () { | |
var self = this; |
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
-- Reference tables | |
DROP TABLE IF EXISTS public.ref_country CASCADE; | |
DROP TABLE IF EXISTS public.ref_us_state CASCADE; | |
CREATE TABLE public.ref_country ( | |
id SERIAL NOT NULL, | |
country_code CHAR(2) NOT NULL, | |
country_name VARCHAR(45) NOT NULL, | |
currency_code CHAR(3), | |
fips_code CHAR(2), |
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
if (!window.loadScripts) { | |
/** | |
* Load scripts given an array of URLs. | |
* @author Amir Khawaja <[email protected]> | |
* @license MIT | |
* @param {array} scripts - An array of URLs of scripts. | |
* @param {function} done - The function to call once the scripts are loaded. | |
*/ | |
window.loadScripts = function (scripts, done) { | |
var loader = function (src, handler) { |
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
CREATE CLASS USState EXTENDS V; | |
CREATE PROPERTY USState.name string; | |
CREATE INDEX USState.generalSearch ON USState (name COLLATE ci) FULLTEXT; | |
CREATE VERTEX USState SET name = "Alabama"; | |
CREATE VERTEX USState SET name = "Alaska"; | |
CREATE VERTEX USState SET name = "Arizona"; | |
CREATE VERTEX USState SET name = "Arkansas"; | |
CREATE VERTEX USState SET name = "California"; |
NewerOlder