Skip to content

Instantly share code, notes, and snippets.

View hawkrives's full-sized avatar
🦋
Butterflies

Hawken Rives hawkrives

🦋
Butterflies
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Untitled benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="https://wzrd.in/standalone/htmlparser2@3"></script>
<script src="https://wzrd.in/standalone/css-select@1"></script>
<script src="./suite.js"></script>
</head>
@hawkrives
hawkrives / speed-test.md
Created September 26, 2016 04:30
Test of speed tests

lamdba refers to a lambda function, in this case x => x * 2

These were tested by running each one 2500 times, on an array of 2500 values (from 0 to 2499).

                | **Chrome** | **Firefox** | **Safari** |

--------------------|------------|-------------|------------| _.map(lambda) | 127 ms | 116 ms | 114 ms | R.map(lambda) | 87 ms | 83 ms | 84 ms | Array#map(lambda) | 2.57 sec | 2.58 sec | 2.59 sec |

@hawkrives
hawkrives / cmus-mediakeys.py
Last active May 7, 2024 00:41 — forked from drslump/mediakeys.py
Act upon media keys in a Mac under OSX
#!/usr/bin/python
import subprocess
# PyObjC-related imports
from AppKit import NSApplication, NSSystemDefined, NSApplicationActivationPolicyProhibited
from PyObjCTools import AppHelper
KEY_UP = 11
<script src="https://cdn.rawgit.com/straker/html-tagged-template/043f11d7659365d25e3b0784bcd613d1c738253b/index.js"></script>
<div class="wrapper">
<div class="bars"></div>
<div class="grad"></div>
</div>
<style>
.wrapper {
display: flex;
@hawkrives
hawkrives / proposal.yaml
Last active November 17, 2023 13:20
A proposal for a new search query language for Gobbldygook
old: 'dept: $NOR dept: AMCON dept: GCON gereq: HWC year: 2015'
new: 'dept: !AMCON and !GCON gereq: HWC year: 2015'
op:: $and
value:
- op: $and
value:
- {op: $ne, key: 'dept', value: 'AMCON'}
- {op: $ne, key: 'dept', value: 'GCON'}
- op: $eq
@hawkrives
hawkrives / convert-to-pages-09.sh
Last active May 8, 2024 08:11
Scripts to convert from Pages '08 documents to Pages '09
#!/bin/bash
set -e
root=$(pwd)
for file in "$@"; do
cd "$file"
pwd
if [[ -f index.xml.gz ]]; then
@hawkrives
hawkrives / README.md
Last active March 4, 2024 00:29
Hanson to JS to Boolean

This current version is very much broken up between several parts.

Eventually, the Hanson file will go in, and a JSON file will come out; then evaluate will take the JSON, a list of courses, and a map of overrides, and return a mutated ("enhanced") object with enough info (hopefully) to render the sidebar info pane.

Currently, though, the glue between the PEGjs parser and the file reader isn't written, so it has to be done manually.

Each "result" string must be fed into the peg, then copied back into the Hanson file. The Hanson file also needs to have types assigned to the requirements themselves, and enough braces put in that it becomes valid JSON.

Might be easiest to use the online JS-yaml tool at http://nodeca.github.io/js-yaml, then copy each result string into the online PEGjs parser at http://pegjs.org/online, then copy it back to replace the result string with the result object.

"use strict";
var React = require('react');
var Router = require('react-router');
var Link = Router.Link;
var Index = React.createClass({
mixins: [ Router.State ],
render: function () {
var name = this.getPath();
@hawkrives
hawkrives / moodle.css
Created May 17, 2015 16:48
sto moodle retheme
*, *::before, *::after {
box-sizing: border-box;
}
body {
margin: 0;
font-family: Fira Sans, Calibri, Lucida Grande, Verdana, sans-serif;
font-weight: 300;
color: #4d4d4f;
}