Skip to content

Instantly share code, notes, and snippets.

View sethlivingston's full-sized avatar

Seth Livingston sethlivingston

View GitHub Profile
module Components.Tab exposing (Model, Msg, init, view, update)
import Html exposing (Html, div, text, i)
import Html.Attributes exposing (class)
import Html.Events exposing (onClick)
-- MODEL
type alias Model =
{ icon : String
Reason # type face = | Jack | Queen | King | Ace;
type face = Jack | Queen | King | Ace
Reason # let f1 = Queen;
let f1 : face = Queen
Reason # let f2 = Ace;
let f2 : face = Ace
Reason # f1 > f2;
type suit =
| Diamonds | Clubs | Hearts | Spades;
type rank =
| Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten;
type face =
| Jack | Queen | King | Ace;
@sethlivingston
sethlivingston / react-redux-component.jsx
Last active January 29, 2016 15:38
Samples from an actual React/Redux application
import classNames from 'classnames';
import React from 'react';
const NavTab = ({ selected, icon, onClick, children }) => {
let tabClasses = classNames({
'nav-tab': true,
'selected': selected
});
let iconClasses = `fa fa-${icon} fa-lg fa-fw`;
var classnames = require('classnames');
var {Link, History} = require('react-router');
var React = require('react');
var NavPanelButton = React.createClass({
mixins: [History],
click: function (e) {
e.preventDefault();
Workflow.run = function (actions) {
var files = [];
var promise = Promise.resolve(files);
actions.forEach(function(action) {
promise = promise.then(function (outFiles) {
// Need to return a promise here to keep the chain going
return new Action(action, outFiles);
});
});
promise = promise.catch(function (error) {
@sethlivingston
sethlivingston / request.http
Last active August 29, 2015 14:13
Returning a text file from ServiceStack
GET /DocData/api/replication/db.json?DbName=test HTTP/1.1
Host: localhost
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: ss-id=hO2XaZXMotKtMOEOE4WF; ss-pid=9MwQlX6VDITl5UcGsLfH; DocStudySetId=7945916; AuthSession=
@sethlivingston
sethlivingston / gist:d7766adaf09198fb0eab
Created September 7, 2014 02:30
Ampersand tutorial - npm install
npm install
node.unplug(Y.DD.Drag);
node.plug(Y.Plugin.Drag);
node.dd.plug(Y.Plugin.DDConstrained, {
constrain2node: constrainNode,
tickX: gridSize,
tickY: gridSize
});
node.dd.plug(Y.Plugin.DDWinScroll);
...
@sethlivingston
sethlivingston / app.coffee
Last active August 29, 2015 14:04
Understanding Y.App Transitions
MyApp = Y.Base.create 'myApp', Y.App, [],
views:
signIn:
type: SignInView
requestPasswordReset:
type: RequestPasswordResetView
parent: 'signIn'
checkEmail:
type: CheckEmailView