<commit_before>/**
 * @jsx React.DOM
 */

function clamp(n, min, max) {
  return Math.min(Math.max(n, min), max);
}

function round(n, min, max, pct) {
  pct = pct || .5;
  if (n > min + (max - min) * pct) {
    return max;
  } else {
    return min;
  }
}

var App = React.createClass({
  mixins: [TweenMixin],
  componentDidMount: function() {
    setInterval(this.updateTicks, 500);
  },
  updateTicks: function() {
    this.setState({ticks: this.state.ticks + 1});
  },
  getInitialState: function() {
    return {pos: -150, animating: 0, ticks: 0};
  },
  clampPos: function(desiredPos) {
    return clamp(desiredPos, -150, 0);
  },
  handleSwiping: function(data) {
    this.setState({
      pos: this.clampPos(
        this.state.pos + data.offset.x
      )
    });
    return false;
  },
  handleStartGesturing: function() {
    this.setState({animating: 1});
  },
  handleStopGesturing: function(swiping) {
    if (!swiping) {
      this.setState({animating: 0});
    }
  },
  handleSwiped: function(data) {
    // TODO: look at velocity as part of the ease
    var desiredPos = round(this.state.pos, -150, 0, .33);
    this.tweenState()
      .to({pos: desiredPos}, 200, EasingFunctions.easeInOutCubic)
      .to({animating: 0}, 0); //createjs.Ease.bounceOut);
    return false;
  },
  handleOpen: function() {
    this.tweenState()
      .to({animating: 1}, 0)<commit_msg>checkpoint, not sure if i want this<commit_after>/**
 * @jsx React.DOM
 */

function clamp(n, min, max) {
  return Math.min(Math.max(n, min), max);
}

function round(n, min, max, pct) {
  pct = pct || .5;
  if (n > min + (max - min) * pct) {
    return max;
  } else {
    return min;
  }
}

var App = React.createClass({
  mixins: [TweenMixin],
  componentDidMount: function() {
    setInterval(this.updateTicks, 500);
  },
  updateTicks: function() {
    this.setState({ticks: this.state.ticks + 1});
  },
  getInitialState: function() {
    return {pos: -150, animating: 0, ticks: 0};
  },
  clampPos: function(desiredPos) {
    return clamp(desiredPos, -150, 0);
  },
  roundPos: function(desiredPos) {
    return round(desiredPos, -150, 0, .33);
  },
  handleSwiping: function(data) {
    this.setState({
      pos: this.clampPos(
        this.state.pos + data.offset.x
      )
    });
    return false;
  },
  handleStartGesturing: function() {
    this.setState({animating: 1});
  },
  handleStopGesturing: function(swiping) {
    if (!swiping) {
      this.setState({animating: 0, pos: this.roundPos(this.state.pos)});
    }
  },
  handleSwiped: function(data) {
    // TODO: look at velocity as part of the ease
    var desiredPos = this.roundPos(this.state.pos);
    this.tweenState()
      .to({pos: desiredPos}, 200, EasingFunctions.easeInOutCubic)
      .to({animating: 0}, 0); //createjs.Ease.bounceOut);
    return false;
  },
  handleOpen: function() {
    this.tweenState()
      .to({animating: 1}, 0)
{'fraction_non_alphanumeric': 0.1633356305995865, 'fraction_numerical': 0.019986216402481046, 'mean_word_length': 2.949659863945578, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3896518', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1070, 'n_words': 235}