Skip to content

Instantly share code, notes, and snippets.

View exogen's full-sized avatar

Brian Beck exogen

View GitHub Profile
@exogen
exogen / bus_schedule.py
Last active February 18, 2016 02:07
Big rruleset
from datetime import datetime
from dateutil.parser import parse
from dateutil.rrule import MO, TU, WE, TH, FR, SA, SU
from dateutil.rrule import rrule, rruleset, WEEKLY
rs = rruleset()
WEEKDAY_TIMES = [
{ "byhour": 5, "byminute": 0 },
{ "byhour": 5, "byminute": 15 },
<!doctype html>
<html lang="en-US" itemscope itemtype="http://schema.org/WebPage">
<head>
<script>
var t_page_start=new Date().getTime();
var _boomr=_boomr||[];
(function(d){var b=d.createElement('script');b.src='http://i2.walmartimages.com/js/rollups/rum.jsp';b.setAttribute('async','true');b.setAttribute('defer','defer');var s=d.getElementsByTagName('script')[0];s.parentNode.insertBefore(b, s);})(document);
</script>
<!-- Fix for iPad issue: item page isn't centered; large white right margin instead (OSO Site team, CASE00576055) -->
_.chain
_.compact
_.difference
_.each
_.every
_.filter
_.findIndex
_.flatten
_.flattenDeep
_.includes
@exogen
exogen / chart-new.jsx
Created October 22, 2015 05:57
New per-datum style
<VictoryChart
interpolation="basis"
axisLabels={{x: "x axis", y: "y axis"}}
x={[
[1, 2, 3, 4],
[-2, -1, 0, 1, 3],
[3, 4, 6]
]}
y={[
[1, 2, 10, 4],
@exogen
exogen / chart.jsx
Created October 22, 2015 05:54
Current per-datum style
<VictoryChart
interpolation="basis"
axisLabels={{x: "x axis", y: "y axis"}}
x={[
[1, 2, 3, 4],
[-2, -1, 0, 1, 3],
[3, 4, 6]
]}
y={[
[1, 2, 10, 4],
import React from 'react';
import ReactDOM from 'react-dom';
import Playground from 'component-playground';
const examples = {
block: require('raw!./examples/block.example')
}
class Demo extends React.Component {
render() {
@exogen
exogen / script.js
Last active October 8, 2015 21:49
Correct atomic-callback-on-execute async script loading
/**
* Script loading is difficult thanks to IE. We need callbacks to fire
* immediately following the script's execution, with no other scripts
* running in between. If other scripts on the page are able to run
* between our script and its callback, bad things can happen, such as
* `jQuery.noConflict` not being called in time, resulting in plugins
* latching onto our version of jQuery, etc.
*
* For IE<10 we use a relatively well-documented 'preloading' strategy,
* which ensures that the script is ready to execute *before* appending
@exogen
exogen / test.coffee
Created September 23, 2011 17:46
Bug in coffee.vim
# Go to the #{lol} line and press 'o'.
rofl = """
#{lol}
"""
@exogen
exogen / TemplateEngine.coffee
Created September 22, 2011 23:03
Milk (Mustache) template engine for Knockout
ko = require 'knockout'
Milk = require 'milk'
class Template
constructor: (@string) ->
render: (data, options) =>
# Knockout expects an Array-like object of Nodes.
# We could just use createElement and set innerHTML,
# but apparently jQuery's append does some kind of cleanup.
@exogen
exogen / knockout.js
Created March 17, 2011 17:11
Basic Knockout functionality in 100 lines
ko = {};
ko.Observable = function(value) {
this.value = value;
this.subscribers = [];
};
ko.Observable.prototype.get = function() {
return this.value;