Skip to content

Instantly share code, notes, and snippets.

const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers');
const Database = require('wow-classic-items')
const items = new Database.Items()
const professions = new Database.Professions()
const zones = new Database.Zones()
const classes = new Database.Classes()
use include_dir::{include_dir, Dir};
static STATIC_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/assets/webroot");
fn ct_from_path(path: &str) -> &'static str {
let idx = path.rfind(".").unwrap_or_else(|| 0);
let suffix = path.get(idx..).unwrap_or_else(|| ".unknown");
match suffix {
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<meta charset="utf-8">
<script>
var passwordTypingTimer;
var passwordDoneTypingInterval = 400;
// $('#myModal').modal('show')
var passwordHelp = '<br>Try:<ul><li>Adding Special Symbols\n<li>Increasing the Length<li>Using Different case Letters<li>Numbers<li><a onclick="$(\'#breachInfo\').modal(\'show\')" href="#">About password breach data</a></ul>'
import Crypto.Random.random as pycryptrand
import sys
def random_line(afile):
line = next(afile)
for num, aline in enumerate(afile):
if pycryptrand.randrange(num + 2):
continue
line = aline
return line
@bitexploder
bitexploder / py_help.py
Created April 17, 2012 17:30
Sublime Text 2 Python Syntax Error Highlighter
import sublime, sublime_plugin, sublime
"""
A quick syntax error highlighter for python. Place in your sublime text
Packages/User directory
"""
class PyHelp(sublime_plugin.EventListener):
def on_modified(self, view):
view.erase_regions("pyhelp_highlight")
@bitexploder
bitexploder / clrs_topo_sort.py
Created April 12, 2012 12:09
Topological Sorting -- CLRS Graph Example
import sys
class Graph(dict):
def __init__(self):
self.explored = {}
self.finishing = []
self.times = {}
self.time = 0
def add_v(self, v):