Skip to content

Instantly share code, notes, and snippets.

View gosukiwi's full-sized avatar

Federico Ramirez gosukiwi

View GitHub Profile
@gosukiwi
gosukiwi / README.md
Last active February 25, 2016 19:33
alpha_sapphire

alpha_sapphire is a toy programming language concept. Designed for minimal syntax and fully object-oriented expressiveness a-la Smalltalk and Ruby.

Things trying to archieve:

  • Everything should be an object
  • Meta-programming should be easy
  • Syntax shold be minimal yet expressive
  • Should be inspired by Smalltalk and Ruby
  • Should give the power to the programmer, not limit him
@gosukiwi
gosukiwi / README.md
Last active March 30, 2016 07:57
alpha_sapphire draft

alpha_sapphire

Simplistic, interpreted, dynamic, object-oriented language inspired by Ruby and Coffeescript.

Simplistic

While trying to be expressive, the main focus on alpha_sapphire's syntax is to keep it simple. There is always a trade-off between expresiveness and complexity. For instance:

foo() unless bar == 2

Is more expressive than:

@gosukiwi
gosukiwi / fuzzy_search.md
Last active June 15, 2016 19:25
Fuzzy Search

Usage: zf PATTERN [DIR]

Example: zf foo app/

Paste this somewhere. I use it in /usr/local/bin. Remeber to chmod +x /usr/local/bin/zf.

if [ -z "$1" ]
  then
 echo "usage: zf PATTERN [DIR]"
@gosukiwi
gosukiwi / AboutTheStockExample.fs
Created August 2, 2016 01:26
FSharpKoans: AboutTheStockExample solution
namespace FSharpKoans
open FSharpKoans.Core
//---------------------------------------------------------------
// Apply Your Knowledge!
//
// Below is a list containing comma separated data about
// Microsoft's stock prices during March of 2012. Without
// modifying the list, programatically find the day with the
// greatest variance between the opening and closing price.
class Tokenizer
TOKEN_SCANNERS = [
SimpleScanner, # Recognizes simple one-char tokens like `_` and `*`
TextScanner # Recognizes everything but a simple token
].freeze
def tokenize(plain_markdown)
tokens_array = tokens_as_array(plain_markdown)
TokenList.new(tokens_array)
end
class TextScanner < SimpleScanner
def self.from_string(plain_markdown)
text = plain_markdown
.each_char
.take_while { |char| SimpleScanner.from_string(char).null? }
.join('')
Token.new(type: 'TEXT', value: text)
rescue InvalidTokenError
Token.null
end
class SimpleScanner
TOKEN_TYPES = {
'_' => 'UNDERSCORE',
'*' => 'STAR',
"\n" => 'NEWLINE'
}.freeze
def self.from_string(plain_markdown)
char = plain_markdown[0]
Token.new(type: TOKEN_TYPES[char], value: char)
A paragraph __with__ some *text*
@gosukiwi
gosukiwi / demo.rb
Last active June 8, 2017 20:10
Code snippets for markdown compiler blog post, part 1
Markdown.to_html('_Foo_ **bar**') # => "<p><em>Foo<em> <strong>bar<strong></p>"
foo = 1