This file contains 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
# Tic Tac Toe on Crystal based on C implementation https://gist.github.com/MatthewSteel/3158579 | |
def grid_char(i) | |
case i | |
when -1 | |
'X' | |
when 0 | |
' ' | |
when 1 | |
'O' |
This file contains 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
# Huffman Tree generator for Ruby and Crystal | |
# @faustinoaq | |
# Jan, 2017 | |
class Element | |
def initialize(sym = '\0', fr = 1.0) | |
@ch = nil | |
if sym != '\0' | |
@ch = [Element.new] |
This file contains 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
set number | |
set nowrap | |
set expandtab | |
set shiftwidth=2 | |
set tabstop=2 | |
set mouse=a | |
call plug#begin('~/.vim/plugged') | |
Plug 'kien/ctrlp.vim' |
This file contains 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
body { | |
font-family: Arial, Helvetica, sans-serif; | |
max-width: 1280px; | |
margin: 0 auto; | |
padding: 0 5%; | |
} | |
a { | |
text-decoration: none; | |
} |
This file contains 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
;; @faustinoaq | |
;; GNU Emacs 24 | |
;; ~/.emacs.d/init.el | |
;; MELPA packages | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) | |
(package-initialize) |
This file contains 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
A = [] of Nil | |
{% A << 0 %} | |
{% A << "Some String" %} | |
{% p A[0] %} # => 0 | |
{% p A[1] %} # => "Some String" |
This file contains 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
<?xml version="1.0"?> | |
<m> <p x="0.550563524346" y="0.758024984088" z="-0.349682612032"/> | |
<p x="0.62319582135" y="0.436643142534" z="0.648821804759"/> | |
<p x="0.975676690271" y="-0.177816333299" z="-0.12820432003"/> | |
<p x="-0.32007250628" y="0.0780544757795" z="0.944172171553"/> | |
<p x="0.437594031513" y="-0.598061218782" z="0.671441912732"/> | |
<p x="0.32007250628" y="-0.0780544757795" z="-0.944172171553"/> | |
<p x="0.250253520018" y="-0.916161840828" z="-0.313082508502"/> | |
<p x="-0.437594031513" y="0.598061218782" z="-0.671441912732"/> | |
<p x="-0.62319582135" y="-0.436643142534" z="-0.648821804759"/> |
This file contains 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
def build_url | |
case verb | |
when "get" | |
case action_name | |
when :index then "/" | |
when :show then "/:#{param}" | |
when :new then "/new" | |
when :edit then "/:#{param}/edit" | |
end | |
when "post" |
This file contains 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
executable = "bin/critter" | |
deps = [] of String | |
output = `ldd #{executable}`.scan(/(\/.*)\s\(/) do |m| | |
library = m[1] | |
deps << library | |
real_lib = File.real_path(library) | |
deps << real_lib if real_lib != library | |
end |
This file contains 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
require "kemal" | |
def index(env) | |
"Hello World!" | |
end | |
get "/", &->index(HTTP::Server::Context) | |
Kemal.run |
OlderNewer