Skip to content

Instantly share code, notes, and snippets.

View AndyNovo's full-sized avatar

Andy Novocin AndyNovo

View GitHub Profile
@AndyNovo
AndyNovo / dabblet.css
Created January 5, 2016 22:45
Display play
/**
* Display play
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
}
span {
{
"name": "API-example",
"version": "0.0.0",
"description": "Serving UTC time",
"main": "server.js",
"repository": "",
"author": "Andy Novocin",
"dependencies": {
"express": "~3.2.4"
}
<!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;
<!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);
<!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>
#include <iostream>
#include <stdlib.h>
#include <cassert>
using namespace std;
struct Cat {
int lives;
int id;
Cat(int in_id){
lives = 9;
<?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.
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]
<?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];
<?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);
};