Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View zeroasterisk's full-sized avatar

alan blount zeroasterisk

View GitHub Profile
@zeroasterisk
zeroasterisk / spec.json
Created March 22, 2023 01:40
Radar Chart Vega spec from Tue Mar 21 2023
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A radar chart example, showing multiple dimensions in a radial layout.",
"width": 400,
"height": 400,
"padding": 40,
"autosize": {"type": "none", "contains": "padding"},
"signals": [{"name": "radius", "update": "width / 2"}],
"data": [
{
@zeroasterisk
zeroasterisk / user.ex
Last active August 4, 2021 03:22
Example Elixir+Ecto schema to mirror a Mongo DB with complicated data structures
defmodule Eltoroportal.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
alias Eltoroportal.Accounts.User
@primary_key {:_id, :string, autogenerate: false}
schema "users" do
field :username, :string
# field :created, :date # <-- ? mongo translation?
@zeroasterisk
zeroasterisk / make_class_teams.js
Last active May 3, 2017 14:57
Code Lou - FSJS - teams
/**
* Build a set of randomized, evenly distrubted teams
*
* goal team size = ~5 or 6
*
* usage:
* download file and save as make_class_teams.js
*
* $ node make_class_teams.js
*
@zeroasterisk
zeroasterisk / CardBtn.js
Last active November 21, 2016 06:54
submit button react component for uniforms
const OLCardBtns = props => (
<div>
<ErrorsField />
<div className="text-xs-right">
<DisplayIf condition={(ctx) => ctx.error}>
<button className="btn btn-warning disabled" disabled>
<Fa className="remove" />
Error
</button>
</DisplayIf>
@zeroasterisk
zeroasterisk / wkb.js
Created November 2, 2016 20:17
import poly data from taradel
var Buffer = require('buffer').Buffer;
var wkx = require('wkx');
function convertHex(hexInput) {
var wkbBuffer = new Buffer(hexInput.slice(2), 'hex');
var geometry = wkx.Geometry.parse(wkbBuffer);
return geometry.toGeoJSON();
}
function convertTwkb(hexInput) {
var wkbBuffer = new Buffer(hexInput.slice(2), 'hex');
@zeroasterisk
zeroasterisk / meteor-release-1.4.2.log
Created October 11, 2016 18:18
bug when trying to run meteor from checkout on release-1.4.2
| (#5) Profiling: ProjectContext prepareProjectForBuild
| Preparing to build package reactive-dict /
| ProjectContext prepareProjectForBuild...........................846 ms (1)
| ├─ _initializeCatalog...........................................508 ms (1)
| │ └─ LocalCatalog#initialize...................................507 ms (1)
| │ ├─ LocalCatalog#_computeEffectiveLocalPackages..............7 ms (1)
| │ │ ├─ optimistic statOrNull 1 ms (156)
| │ │ ├─ optimistic hashOrNull 1 ms (155)
| │ │ └─ other LocalCatalog#_computeEffectiveLocalPackages 5 ms
| │ └─ LocalCatalog#_loadLocalPackages........................500 ms (1)
@zeroasterisk
zeroasterisk / lodash-forEach.js
Created October 10, 2016 20:22
node --trace_opt --trace_deopt --allow-natives-syntax node_modules/lodash/forEach.js
[disabled optimization for 0x29b4e2147b41 <SharedFunctionInfo SAR>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x29b4e2146651 <SharedFunctionInfo ADD>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x29b4e2147da9 <SharedFunctionInfo SHR>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x29b4e21480c9 <SharedFunctionInfo IN>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x29b4e21c02a9 <SharedFunctionInfo NativeModule.require>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x29b4e21bf829 <SharedFunctionInfo NativeModule>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x29b4e2147421 <SharedFunctionInfo BIT_OR>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x29b4e21d0f21 <SharedFunctionInfo createBuffer>, reason: TryFinallyStatement]
[disabled optimization for 0x29b4e2146e99 <SharedFunctionInfo MUL>, reason: Call to a
@zeroasterisk
zeroasterisk / DateRangePickerWrapper.js
Created September 29, 2016 05:00
react-dates & uniforms = start/stop date range picker glory
import React from 'react';
import { DateRangePicker } from 'react-dates';
import momentPropTypes from 'react-moment-proptypes';
class DateRangePickerWrapper extends React.Component {
constructor(props) {
super(props);
this.state = {
focusedInput: null,
startDate: props.startDate || null,
@zeroasterisk
zeroasterisk / MapEditField.js
Last active September 28, 2016 21:02
React Uniforms Field for a map configuration
import _ from 'lodash';
import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
import { Bert } from 'meteor/themeteorchef:bert';
import React from 'react';
import { BaseField } from 'uniforms';
import UIMapPoly from 'react-map-polygon-selector';
@zeroasterisk
zeroasterisk / buildPhantomJSAsLinux-inDocker.sh
Created September 21, 2016 19:04
Build a node lambda function for
#!/bin/bash
# If you are developing on OSX on Windows
# but you want to run on linux - or in docker - or on AWS Lambda
# PhantomJS must be the binary for that OS...
# https://github.com/sindresorhus/pageres/issues/275
#
# Easiest solution, download inside a docker, running on linux
#
# This script should be run from within the docker container
#