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
/** | |
* Display play | |
*/ | |
body { | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; | |
} | |
span { |
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
{ | |
"name": "API-example", | |
"version": "0.0.0", | |
"description": "Serving UTC time", | |
"main": "server.js", | |
"repository": "", | |
"author": "Andy Novocin", | |
"dependencies": { | |
"express": "~3.2.4" | |
} |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>Sample SPA using HashChange</title> | |
<script type="text/javascript" charset="utf-8"> | |
var handleHash = function(){ | |
alert("Hash changed to "+location.hash); | |
document.body.innerHTML = document.querySelector(location.hash).innerHTML; |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>Sample SPA using HashChange</title> | |
<script type="text/javascript" charset="utf-8"> | |
var handleHash = function(){ | |
document.body.innerHTML = document.querySelector(location.hash).innerHTML; | |
}; | |
window.addEventListener("hashchange", handleHash); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://polygit.org/components/webcomponentsjs/webcomponents-lite.js"></script> | |
<link rel="import" href="ninja.html"> | |
</head> | |
<body> | |
<ninja-killa></ninja-killa> | |
<ninja-killa></ninja-killa> | |
<ninja-killa></ninja-killa> |
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
#include <iostream> | |
#include <stdlib.h> | |
#include <cassert> | |
using namespace std; | |
struct Cat { | |
int lives; | |
int id; | |
Cat(int in_id){ | |
lives = 9; |
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
<?php | |
//this is the basic way of getting a database handler from PDO, PHP's built in quasi-ORM | |
$dbhandle = new PDO("sqlite:scrabble.sqlite") or die("Failed to open DB"); | |
if (!$dbhandle) die ($error); | |
//this is a sample query which gets some data, the order by part shuffles the results | |
//the limit 0, 10 takes the first 10 results. | |
// you might want to consider taking more results, implementing "pagination", | |
// ordering by rank, etc. |
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
import hashlib, cProfile | |
f=file('dictionary.txt','r') | |
words = [word.strip() for word in f] | |
f.close() | |
secretHash=hashlib.sha512("banana").hexdigest() | |
def checkDictionary(secret): | |
return [word for word in words if hashlib.sha512(word).hexdigest() == secret] |
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
<?php | |
$myrack = "AAABNN"; | |
$racks = []; | |
for($i = 0; $i < pow(2, strlen($myrack)); $i++){ | |
$ans = ""; | |
for($j = 0; $j < strlen($myrack); $j++){ | |
//if the jth digit of i is 1 then include letter | |
if (($i >> $j) % 2) { | |
$ans .= $myrack[$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
<?php | |
function generate_rack($n){ | |
$tileBag = "AAAAAAAAABBCCDDDDEEEEEEEEEEEEFFGGGHHIIIIIIIIIJKLLLLMMNNNNNNOOOOOOOOPPQRRRRRRSSSSTTTTTTUUUUVVWWXYYZ"; | |
$rack_letters = substr(str_shuffle($tileBag), 0, $n); | |
$temp = str_split($rack_letters); | |
sort($temp); | |
return implode($temp); | |
}; |