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
var request = require('request'); | |
function callback(){ | |
console.log('-------------------------------------------------------THIS ONE IS IN A CALLBACK'); | |
} | |
function getJSON(callback) { | |
request('http://localhost/cinema.json', function(error, response, body) { | |
if(!error && response.statusCode == 200) { | |
console.log(body); |
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
// To find counts of days of the week use this | |
// getUTCDay returns a Day (0-6) see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date for more | |
// Examples: getUTCMonth for Months (0-11), getUTCHours (0-23) | |
db.gmail_data.mapReduce( | |
function() { | |
var dateDoc; | |
for( var i = 0; i < this.payload.headers.length; i++ ) { | |
var currDoc = this.payload.headers[i]; | |
if (currDoc.name === 'Date') { | |
dateDoc = currDoc; |
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
#!/bin/bash | |
echo "Starting" | |
lockfile=/home/adispen/PokemonGo-Map-dev/lock/map.lock | |
function runMap { | |
pwd | |
python runserver.py -a -u -p -l "" -st 5 -H 0.0.0.0 -P 9001 &> /home/adispen/PokemonGo-Map-dev/logs/map1.log & | |
python runserver.py -a -u -p -l "" -st 5 -H 0.0.0.0 -P 9002 &> /home/adispen/PokemonGo-Map-dev/logs/map2.log & |
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 checkBind() { | |
var isBound = false; | |
if ($('.live-count').length) { | |
$.each($('.live-count').data('events'), function (i) { | |
if (i === 'DOMSubtreeModified') { | |
isBound = true; | |
return; | |
} | |
}); | |
} |
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
var debug = require('../helpers/debug'); | |
function checkBind() { | |
console.log('checking'); |
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
db['streams'].aggregate([ | |
{"$unwind":"$stats"}, | |
{"$match":{"$and":[{"stats.rank":{"$lt":10}}, {"stats.time":{"$gt":"2016.06.25.07.00.42"}}]}}, | |
{"$group":{"_id":{"stats":"$stats","name":"$name"}}}, | |
{"$project":{"stats":"$_id.stats","name":"$_id.name","_id":0,"viewers":"$_id.stats.viewers","time":"$_id.stats.time"}}, | |
{"$limit":10000} | |
]) |
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
$("div.player-livestatus__online").text(function(){ | |
return $(".live-count").text() + "Viewers"; | |
}) | |
$(".live-count").bind("DOMSubtreeModified", function(){ | |
$("div.player-livestatus__online").text(function(){ | |
return $(".live-count").text() + "Viewers"; | |
}) | |
}) |
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 static void shortestPath(Vertex[] friendGraph, String name1, String name2){ | |
name1 = name1.toLowerCase(); | |
name2 = name2.toLowerCase(); | |
int n1Index = 0; | |
Stack<Vertex> friendStack = new Stack<Vertex>(); | |
for(int j = 0; friendGraph[j].neighborList.next != null; j++){ | |
System.out.println(friendGraph[j].name); | |
if(friendGraph[j].name.toLowerCase().equals(name1)){ | |
n1Index = 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
public Stack<Vertex> bfs(String name, int i, Vertex[] friendGraph){ | |
Stack<Vertex> friendStack = new Stack<Vertex>(); | |
Queue<Neighbor> neighborQueue = new LinkedList<Neighbor>(); | |
Neighbor l = null; | |
friendGraph[i].prev = -1; | |
do{ | |
for(Neighbor j = friendGraph[i].neighborList; j != null; j = j.next){ | |
if(friendGraph[j.vertexNum].prev == -2){ | |
neighborQueue.offer(j); | |
friendGraph[j.vertexNum].prev = i; |
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 static Stack<Vertex> bfs(String name, int i, Vertex[] friendGraph){ | |
Stack<Vertex> friendStack = new Stack<Vertex>(); | |
Queue<Neighbor> neighborQueue = new LinkedList<Neighbor>(); | |
Neighbor l = null; | |
friendGraph[i].prev = -1; | |
do{ | |
for(Neighbor j = friendGraph[i].neighborList; j != null; j = friendGraph[j.vertexNum].neighborList.next){ | |
if(friendGraph[j.vertexNum].name.equals(name)){ | |
for(int k = i; k != -1; k = friendGraph[k].prev){ | |
friendStack.push(friendGraph[k]); |