This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WORLD_SIZE = [0..31] | |
| BLOCKS = _([1, 1, 33, 34, 50]).reverse() | |
| Vector = | |
| add: (a, b) -> | |
| {x: a.x + b.x, y: a.y + b.y} | |
| subtract: (a, b) -> | |
| {x: a.x - b.x, y: a.y - b.y} | |
| multiply: (a, b) -> | |
| {x: a.x * b, y: a.y * b} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| import sublime_plugin | |
| from os import path | |
| IS_RAILS = re.compile(r'(/app/(controllers|helpers|mailers|models)/|/config/routes|/db/migrate/).+\.rb$') | |
| class GuessRubyTypeListener(sublime_plugin.EventListener): | |
| def on_load(self, view): | |
| name = view.file_name() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Place all the behaviors and hooks related to the matching controller here. | |
| # All this logic will automatically be available in application.js. | |
| # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ | |
| $ -> | |
| $('#dupe_image').data('n', 0).attr(id: 'dupe_image_0', name: 'dupe[image][0]').change -> | |
| $this = $(this) | |
| n = $this.data('n') + 1 | |
| parent = $this.unbind('change').parents('.clearfix')[0] | |
| $parent = $(parent) | |
| $node = $(parent).clone() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Place all the behaviors and hooks related to the matching controller here. | |
| # All this logic will automatically be available in application.js. | |
| # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ | |
| #= require Markdown.Converter.js | |
| #= require Markdown.Sanitizer.js | |
| $ -> | |
| converter = Markdown.getSanitizingConverter() | |
| $('#dupe_description').keyup (evt) -> | |
| $('#md_preview').html converter.makeHtml $(this).val() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http = require 'http' | |
| server = http.createServer (req, res) -> | |
| res.writeHead 200 | |
| res.end "Hello, World!" | |
| server.listen 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fs = require 'fs' | |
| connect = require 'connect' | |
| io = require 'socket.io' | |
| coffee = require 'coffee-script' | |
| coffee_cache = {} | |
| server = connect.createServer( | |
| connect.static(__dirname + '/public') | |
| (req, res, next) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Scope | |
| constructor: (@values={}) -> | |
| get: (name) -> @values[name] | |
| set: (name, value) -> @values[name] = value | |
| class Node | |
| class Statement extends Node | |
| execute: (scope) -> | |
| throw new Exception("WAT DO") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| if ?A.is_a? String | |
| ab = (?A..?Z).to_a | |
| else | |
| ab = (?A..?Z).map {|c| c.chr} | |
| end | |
| n = $<.readline.to_i | |
| str = $<.read | |
| puts str.split('').map {|oc| c = oc.upcase; if ab.include? c then r = ab[(ab.index(c) - n) % ab.length]; c == oc ? r : r.downcase else c end }.join |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {Parser} = require 'jison' | |
| # Stolen from coffee-script | |
| # Since we're going to be wrapped in a function by Jison in any case, if our | |
| # action immediately returns a value, we can optimize by removing the function | |
| # wrapper and just returning the value directly. | |
| unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/ | |
| # Our handy DSL for Jison grammar generation, thanks to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {Parser} = require 'jison' | |
| # Stolen from coffee-script | |
| # Since we're going to be wrapped in a function by Jison in any case, if our | |
| # action immediately returns a value, we can optimize by removing the function | |
| # wrapper and just returning the value directly. | |
| unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/ | |
| # Our handy DSL for Jison grammar generation, thanks to |