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.factory('socket', function($rootScope) { | |
var socket = io.connect(); | |
return socket; | |
}); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Unit testing template"> | |
<meta charset="utf-8"> | |
<title>testing on jsbin</title> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/mocha/1.18.2/mocha.css"> | |
</head> | |
<body> | |
<div id="mocha"></div> |
This file has been truncated, but you can view the full file.
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" standalone="yes"?> | |
<?xml-stylesheet type="text/xsl" href="details.xsl"?> | |
<gpx | |
version="1.1" | |
creator="Strava Android Application" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns="http://www.topografix.com/GPX/1/1" | |
xmlns:topografix="http://www.topografix.com/GPX/Private/TopoGrafix/0/1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.topografix.com/GPX/Private/TopoGrafix/0/1 http://www.topografix.com/GPX/Private/TopoGrafix/0/1/topografix.xsd"> | |
<trk> | |
<name><![CDATA[Evening Ride]]></name> |
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
from collections import OrderedDict | |
def has_cycle_rec(graph, node, parents = None): | |
parents = parents or set() | |
parents.add(node) | |
for child in graph[node]: | |
if child in parents or has_cycle_rec(graph, child, parents): | |
return True | |
parents.remove(node) | |
return False |
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
from collections import OrderedDict | |
def has_cycle_rec(graph, node, parents = None): | |
parents = parents or set() | |
parents.add(node) | |
for child in graph[node]: | |
if child in parents or has_cycle_rec(graph, child, parents): | |
return True | |
parents.remove(node) | |
return False |
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
from collections import OrderedDict | |
def has_cycle_rec(graph, node, parents = None): | |
parents = parents or set() | |
parents.add(node) | |
for child in graph[node]: | |
if child in parents or has_cycle_rec(graph, child, parents): | |
return True | |
parents.remove(node) | |
return False |
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
from collections import DefaultDict | |
# an acyclic graph will always have a leaf node | |
# cycle graph will not | |
def solve(graph, node): | |
# sum to n = ((n + 1) * n / 2) | |
# if edges max is n | |
# if edges > n * (n-1)/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
// | |
// ViewController.swift | |
// GPS Tracker | |
// | |
// Created by David Adler on 04/03/2018. | |
// Copyright © 2018 David Adler. All rights reserved. | |
// | |
// - Blog overview https://www.raywenderlich.com/143128/background-modes-tutorial-getting-started | |
// - Background location in swift https://stackoverflow.com/a/45567876/1376627 | |
// - Conforming to delegate https://stackoverflow.com/questions/35900126/cannot-assign-value-of-type-appdelegate-to-type-cllocationmanagerdelegate |
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
from timer import Timer | |
import matplotlib.pyplot as plt | |
class Solution(object): | |
def longestCommonPrefix(self, strings): | |
if not len(strings): | |
return 0 | |
if len(strings) == 1: | |
return len(strings[0]) |
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 pprint | |
# treasure finding game | |
# 2d board = array of arrays | |
# initialized with num rows, num cols | |
# treasure position (row, col) | |
# all positions hidden, player reveals positions | |
# player starts where he wants | |
# betting site, find treasure on board | |
# step to next user |