Skip to content

Instantly share code, notes, and snippets.

View hawkrives's full-sized avatar
🦋
Butterflies

Hawken Rives hawkrives

🦋
Butterflies
View GitHub Profile
@hawkrives
hawkrives / select2.bookmarklet.js
Last active December 17, 2024 17:46
Bookmarklet to turn <select>s into <select²>s
javascript:(function()%7Bvar%20select2%3D%7Bcss%3A%22https%3A%2F%2Fcdn.rawgit.com%2Fivaynberg%2Fselect2%2F8cc9d48d5881a5760178b5cd615c5174fbd98672%2Fselect2.css%22%2Cjs%3A%22https%3A%2F%2Fcdn.rawgit.com%2Fivaynberg%2Fselect2%2F8cc9d48d5881a5760178b5cd615c5174fbd98672%2Fselect2.min.js%22%7D%2CselectCssLoadedPromise%3Dnew%20Promise(function(a%2Cb)%7Bconsole.log(%22inside%20css%20promise%22)%2Cselect2.link%3Ddocument.createElement(%22link%22)%2Cselect2.link.onload%3Dfunction()%7Bconsole.log(%22select%20css%20loaded%22)%2Ca()%7D%2Cselect2.link.onerror%3Dfunction(a)%7Bconsole.log(%22select%20css%20errored%22%2Ca)%2Cb()%7D%2Cselect2.link.href%3Dselect2.css%2Cselect2.link.rel%3D%22stylesheet%22%2Cselect2.link.type%3D%22text%2Fcss%22%2Cdocument.body.appendChild(select2.link)%7D)%2CselectScriptLoadedPromise%3Dnew%20Promise(function(a%2Cb)%7Bconsole.log(%22inside%20js%20promise%22)%3Bvar%20c%3Ddocument.createElement(%22script%22)%3Bc.onload%3Dfunction()%7Bconsole.log(%22select%20js%20loaded%22)%2Ca()%7D%2Cc.onerror%3Df
command: "echo Hello World!",
refreshFrequency: 5000,
render: function (output) {
return "<div><h1>" + output + "</h1></div>";
},
style: [
"top: 20px",
console.log('obj 1');
var obj = {
data: 0,
get x() {
return this.data + 1;
}
}
console.log(obj.x);
@hawkrives
hawkrives / gist:8895bca135959ca875ae
Created November 29, 2014 23:04
Possible SVGDiplomacy game format
{
id: 'sdywf9874ia8hos9290',
owner: '8WswhCVIse',
players: ['hawkrives', 'heroine', 'dominator'],
mapName: 'Europe',
mapId: '91nf8932',
title: 'STOLAF DOMINATES EUROPE!',
}
import '6to5/runtime'
import csp from "js-csp"
function* player(name, table) {
while (true) {
var ball = yield csp.take(table);
if (ball === csp.CLOSED) {
console.log(name + ": table's gone");
return;
}
@hawkrives
hawkrives / src.js
Last active October 20, 2024 17:12
6to5 _interopRequire and node `exports`
let coursesAtOrAboveLevel = (level, course) => (course.level >= level)
export {coursesAtOrAboveLevel}
@hawkrives
hawkrives / gist:5d3a5bd1d40cf4e02ab8
Last active May 3, 2024 16:15
chem 398 for cs elective proposal
  • This course is devoted to team research/development projects, employing established software development methodologies.
  • Projects frequently have:
    • an interdisciplinary nature,
    • involving consultation with faculty and/or students in other fields,
    • and taking advantage of the particular backgrounds of team members.
  • One or more research papers, posters ,etc., on results are ordinarily expected.
  • Offered alternate years.
  • Prerequisites: one core course with implementation in computer science or permission of instructor.
@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;
}
"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 / README.md
Last active September 25, 2024 18:28
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.