This file contains hidden or 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 connect = require('connect'), | |
| serveStatic = require('serve-static'), | |
| vhost = require('vhost') | |
| var mailapp = connect() | |
| // add middlewares to mailapp for mail.example.com | |
| // create app to serve static files on subdomain | |
| var staticapp = connect() |
This file contains hidden or 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 http = require('http'), | |
| ApiCluster = require('apicluster'); | |
| ApiCluster | |
| .defaults({ | |
| name: 'mydefault', | |
| config: { | |
| 'employee': 'emp', | |
| 'details': 'details', |
This file contains hidden or 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
| <html> | |
| <head> | |
| <title>Social Message Board</title> | |
| <link rel="stylesheet" type="text/css" href="css\style.css"> | |
| </head> | |
| <body> | |
| <div id="message-board"> | |
| <div id="messages"></div> | |
| <form id="post-form"> | |
| <input type="text" id="message" /> |
This file contains hidden or 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 bubbleSort(arr){ | |
| var len = arr.length; | |
| for (var i = len-1; i>=0; i--){ | |
| for(var j = 1; j<=i; j++){ | |
| if(arr[j-1]>arr[j]){ | |
| var temp = arr[j-1]; | |
| arr[j-1] = arr[j]; | |
| arr[j] = temp; | |
| } | |
| } |
This file contains hidden or 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 selectionSort(arr){ | |
| var minIdx, temp, | |
| len = arr.length; | |
| for(var i = 0; i < len; i++){ | |
| minIdx = i; | |
| for(var j = i+1; j<len; j++){ | |
| if(arr[j]<arr[minIdx]){ | |
| minIdx = j; | |
| } | |
| } |
This file contains hidden or 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 insertionSort(arr){ | |
| var i, len = arr.length, el, j; | |
| for(i = 1; i<len; i++){ | |
| el = arr[i]; | |
| j = i; | |
| while(j>0 && arr[j-1]>toInsert){ | |
| arr[j] = arr[j-1]; | |
| j--; |
This file contains hidden or 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 mergeSort(arr){ | |
| var len = arr.length; | |
| if(len <2) | |
| return arr; | |
| var mid = Math.floor(len/2), | |
| left = arr.slice(0,mid), | |
| right =arr.slice(mid); | |
| //send left and right to the mergeSort to broke it down into pieces | |
| //then merge those | |
| return merge(mergeSort(left),mergeSort(right)); |
This file contains hidden or 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 quickSort(arr, left, right){ | |
| var len = arr.length, | |
| pivot, | |
| partitionIndex; | |
| if(left < right){ | |
| pivot = right; | |
| partitionIndex = partition(arr, pivot, left, right); | |
This file contains hidden or 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 heapSort(arr){ | |
| var len = arr.length, | |
| end = len-1; | |
| heapify(arr, len); | |
| while(end > 0){ | |
| swap(arr, end--, 0); | |
| siftDown(arr, 0, end); | |
| } |
This file contains hidden or 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
| module.exports = function( grunt ) { | |
| 'use strict'; | |
| // Load grunt tasks automatically | |
| require( 'load-grunt-tasks' )( grunt ); | |
| grunt.loadTasks( 'tasks' ); | |
| // Time how long tasks take. Can help when optimizing build times | |
| require( 'time-grunt' )( grunt ); |
OlderNewer