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'; | |
/************************************************************************************************** | |
* This sample demonstrates a few more advanced features of Swagger-Express-Middleware, | |
* such as setting a few options, initializing the mock data store, and adding custom middleware logic. | |
**************************************************************************************************/ | |
// Set the DEBUG environment variable to enable debug output of Swagger Middleware AND Swagger Parser | |
process.env.DEBUG = 'swagger:*'; | |
var util = require('util'), |
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
app.use(function(req, res,next){ | |
var caller = req.connection.remoteAddress; //Will give you the request IP Address | |
next(); | |
}); | |
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
// Given an input string, and an alphabet, find the shortest substring in the input containing every letter in the alphabet at least once | |
// “aaccbc”, {‘a’, ‘b’, ‘c’} => “accb" | |
// "aaaabbbcccdddcdba", [ 'a', 'b', 'c' ] => cdba | |
for (var i = 0; i < input.length; i++) { | |
for (var j = i; j < input.length; j++) { | |
var s = input.substring(i,j); |
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'; | |
var input = 'cbabadcbbabbcbabaabccbabc'; | |
var match = 'abbc'; | |
var matches = []; | |
var weight = getWeight('abad'); | |
var result = []; | |
for (var i = 0; i < input.length; i++) { | |
if (getWeight(input.substr(i, match.length)) === weight) { |
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
public class TestSum { | |
public static void main(String[] args) { | |
List<Integer> inputNumbers = new ArrayList<Integer>(); | |
inputNumbers.add(3); | |
inputNumbers.add(4); | |
inputNumbers.add(6); | |
inputNumbers.add(2); | |
inputNumbers.add(5); |
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
import RPi.GPIO as GPIO | |
import time | |
GPIO.setmode(GPIO.BOARD) | |
pin_to_circuit=7 | |
GPIO.setup(pin_to_circuit, GPIO.OUT) | |
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
Start Fresh: | |
Step 1: | |
docker pull ramesh1211/optimus:c453d919e443 | |
Step 2: //Stop any existing Docker Processees. | |
docker stop $(docker ps) | |
Step3: | |
docker run -d -p 8009:8080 f914f44dbcc2 |
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
// _Channels_ are the pipes that connect concurrent | |
// goroutines. You can send values into channels from one | |
// goroutine and receive those values into another | |
// goroutine. | |
package main | |
import "bufio" | |
import "fmt" | |
import "net" |
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
function findMedian(input1, input2) { | |
let resultList = sortLists(input1 || [], input2 || []); | |
if (resultList.length > 0) { | |
let medianIdx = Math.floor(resultList.length / 2); | |
if (resultList.length % 2 === 0) { | |
return (resultList[medianIdx - 1] + resultList[medianIdx]) / 2; | |
} else { | |
return resultList[medianIdx]; | |
} |
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
public class LinkedList { | |
private Node head; | |
private Node current; | |
private boolean isFirst = false; | |
private int length; | |
public LinkedList() { | |
} |