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 random | |
def shuffle(deck): | |
shuffled_deck = list() | |
while(len(deck) > 0): | |
sel_pos = int(random.randrange(0,len(deck))) | |
shuffled_deck.append(deck[sel_pos]) | |
deck = deck[:sel_pos] + deck[sel_pos+1:] |
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
# write domain counts to file after every 1,000,000 emails read | |
increment_to_save = 1000000 | |
def write_to_file(file_name, domains): | |
# sort the domains by count | |
from operator import itemgetter | |
domains = sorted(domains, key=itemgetter('count')) | |
# write the domains to the results file | |
results_file = open(file_name, "w") |
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 time | |
# calculate the domain (set of possible values) of the cell at (row, col) | |
def get_domain(board_state, row, col): | |
# initially state of the domain (cell can have any digit from 1-9) | |
domain = range(1, 10) | |
# eliminate illegal values from the domain based on the values in the cell's square |
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 random | |
# number of games to play | |
num_games = 1000000 | |
# keeps track of wins that occur when using | |
# the selection-change-after-reveal strategy | |
reselect_win_tally = 0 | |
for i in range(num_games): |
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 xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Our Example Page for SignalR</title> | |
<!-- js files to include for SignalR--> | |
<script type="text/javascript" src="Scripts/jquery-2.1.3.min.js"></script> | |
<script src="Scripts/jquery.signalR-2.1.2.min.js"></script> | |
<script src="signalr/hubs"></script> |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using Microsoft.AspNet.SignalR; | |
namespace SignalRExample.Hubs | |
{ | |
public class ExampleHub : Hub | |
{ |
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
using System; | |
using System.Threading.Tasks; | |
using Microsoft.Owin; | |
using Owin; | |
[assembly: OwinStartup(typeof(SignalRExample.Startup))] | |
namespace SignalRExample | |
{ | |
public class Startup |
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
/* express initialization */ | |
var express = require('express'); | |
var app = express(); | |
/* body-parser initialization (use the body-parser json package) */ | |
var bodyParser = require('body-parser'); | |
app.use(bodyParser.json()); | |
/* Main Router */ | |
var ourApiRouter = express.Router(); |
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
/* express initialization */ | |
var express = require('express'); | |
var app = express(); | |
/* body-parser initialization (use the body-parser json package) */ | |
var bodyParser = require('body-parser'); | |
app.use(bodyParser.json()); | |
/* Main Router */ | |
var ourApiRouter = express.Router(); |
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
/* | |
* Must have refrences the dlls: | |
* Net.SourceForge.Koogra.dll (here: http://www.antoinedahan.com/blog/ReadingExcelFilesWithKoogra/Net.SourceForge.Koogra.dll) | |
* Ionic.Utils.Zip.dll (here: http://www.antoinedahan.com/blog/ReadingExcelFilesWithKoogra/Ionic.Utils.Zip.dll) | |
*/ | |
using Koogra = Net.SourceForge.Koogra; | |
//Grab the workbook | |
Koogra.IWorkbook workbook = Koogra.WorkbookFactory.GetExcel2007Reader("ExcelWorkbook.xlsx"); |