<commit_before>$(document).ready ->

  # Settings
  CANVAS_WIDTH  = 480
  CANVAS_HEIGHT = 320

  canvasElement = $('canvas')
  canvasElement.attr({height: CANVAS_HEIGHT, width: CANVAS_WIDTH})

  canvas = canvasElement.get(0).getContext('2d')

  FPS = 60

  setInterval(( ->
    update()
    draw()
    return),
    1000/FPS)


  # Utility function
  Number::clamp = (min, max) ->
    Math.min(Math.max(this, min), max)


  # Key handling
  window.keydown = {}

  keyName = (event) ->
    return jQuery.hotkeys.specialKeys[event.which] ||
      String.fromCharCode(event.which).toLowerCase()

  $(document).bind("keydown", (event) ->
    keydown[keyName(event)] = true
    return)

  $(document).bind("keyup", (event) ->
    keydown[keyName(event)] = false
    return)


  # Player
  class Player
    constructor: ->
      @color = "#ccc"
      @x = 220
      @y = 270
      @width = 32
      @height = 32

    draw: ->
      canvas.fillStyle = @color
      canvas.fillRect(@x, @y, @width, @height)
      return

  player = new Player

  # Logic
  textX = 50
  textY = 50

  update = ->
    if keydown.space
      player.shoot()
    if keydown.left
      player.x -= 3
    if keydown.right
      player.x += 3

    player.x = player.x.clamp(0, CANVAS_WIDTH - player.width)
    return

  draw = ->
    canvas.clearRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT)
    player.draw()
    return

  return<commit_msg>Newline<commit_after>$(document).ready ->

  # Settings
  CANVAS_WIDTH  = 480
  CANVAS_HEIGHT = 320

  canvasElement = $('canvas')
  canvasElement.attr({height: CANVAS_HEIGHT, width: CANVAS_WIDTH})

  canvas = canvasElement.get(0).getContext('2d')

  FPS = 60

  setInterval(( ->
    update()
    draw()
    return),
    1000/FPS)


  # Utility function
  Number::clamp = (min, max) ->
    Math.min(Math.max(this, min), max)


  # Key handling
  window.keydown = {}

  keyName = (event) ->
    return jQuery.hotkeys.specialKeys[event.which] ||
      String.fromCharCode(event.which).toLowerCase()

  $(document).bind("keydown", (event) ->
    keydown[keyName(event)] = true
    return)

  $(document).bind("keyup", (event) ->
    keydown[keyName(event)] = false
    return)


  # Player
  class Player
    constructor: ->
      @color = "#ccc"
      @x = 220
      @y = 270
      @width = 32
      @height = 32

    draw: ->
      canvas.fillStyle = @color
      canvas.fillRect(@x, @y, @width, @height)
      return

  player = new Player


  # Logic
  textX = 50
  textY = 50

  update = ->
    if keydown.space
      player.shoot()
    if keydown.left
      player.x -= 3
    if keydown.right
      player.x += 3

    player.x = player.x.clamp(0, CANVAS_WIDTH - player.width)
    return

  draw = ->
    canvas.clearRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT)
    player.draw()
    return

  return
{'fraction_non_alphanumeric': 0.1414790996784566, 'fraction_numerical': 0.023579849946409433, 'mean_word_length': 2.4313725490196076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '1939475', 'n_tokens_mistral': 1069, 'n_tokens_neox': 965, 'n_words': 203}