Skip to content

Instantly share code, notes, and snippets.

View umurgdk's full-sized avatar

Umur Gedik umurgdk

View GitHub Profile
@umurgdk
umurgdk / Goal.scala
Last active July 26, 2016 16:34
CSV Serializer
object DeepGoal {
implicit val deepGoalCodec = AutomaticJsonCodecBuilder[DeepGoal]
def apply(goal:GoalWithId, prevailingMeasure:Option[MeasureWithId]) = {
new DeepGoal(goal.id.id,
goal.model.status,
goal.model.name,
goal.model.agencies,
goal.model.relatedDatasets,
goal.model.isPublic,
root@localhost:~/crystal# make
CRYSTAL_CONFIG_PATH=`pwd`/src ./bin/crystal build -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
Invalid memory access (signal 11) at address 0x7ff5ffeefab8
[12638893] __crystal_sigfault_handler +61
[24690684] sigfault_handler +40
get "/users/:id{Int32}", do |env, id|
# id here Int32
# if :id couldn't parsed as Int32 an error thrown or 404
puts "#{id + 100}"
end
abstract class Parsec::Parser(T)
getter error_message
def initialize
@is_satisfied = false
@is_failed = false
@cargo = ""
@error_message = ""
end
macro choice(*parsers)
current_column = @column_number
begin
{% for name, index in parsers %}
{{name}}
{% if index < parsers.size - 1 %}
rescue
{% end %}
end
end
@umurgdk
umurgdk / .vimrc
Created September 13, 2015 02:23
" source ~/.vim/dwiw-loader.vim
set nocompatible
filetype off
"set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"Plugins
defmodule Feedme.Parsers.RSS2 do
alias Feedme.Feed
alias Feedme.Entry
alias Feedme.MetaData
alias Feedme.Image
alias Feedme.Enclosure
def valid?(document) do
has_version = document
|> XmlNode.first("/rss")
@umurgdk
umurgdk / colors.js
Last active August 29, 2015 14:05
bunch of triangles made with p5.js
var Colors = [
[142, 161, 108],
[194, 207, 48],
[254, 199, 0],
[255, 137, 0],
[211, 67, 43],
[187, 41, 82],
[142, 30, 95],
[222, 74, 182],
[153, 0, 236],
@umurgdk
umurgdk / dumb_module.ex
Created December 28, 2013 02:04
elixir @type, @SPEC test
defmodule DumbModule do
@type dumb_type :: :a | :b
@spec dumb_function(dumb_type) :: dumb_type
def dumb_function(_data) do
:c
end
end
@umurgdk
umurgdk / mix.exs
Last active January 1, 2016 05:49
mix failing on heroku
defmodule ChatExperiment.Mixfile do
use Mix.Project
def project do
[ app: :chat_experiment,
version: "0.0.1",
elixir: "~> 0.12.0",
deps: deps ]
end