Skip to content

Instantly share code, notes, and snippets.

View darkofabijan's full-sized avatar

Darko Fabijan darkofabijan

View GitHub Profile
iex(33)> Code.eval_quoted(quote do: [unquote_splicing([{4, "show/:id"}])])
{[{4, "show/:id"}], []}
iex(34)> Code.eval_quoted(quote do: [unquote_splicing([{4, "show/:id", 1, 2}])])
** (CompileError) nofile: invalid quoted expression: {4, "show/:id", 1, 2}
(elixir) src/elixir_exp.erl:408: :elixir_exp.expand_arg/2
(elixir) src/elixir_exp.erl:384: :elixir_exp.expand_list/4
(elixir) src/elixir_exp.erl:358: :elixir_exp.expand/2
(elixir) src/elixir.erl:150: :elixir.quoted_to_erl/3
(elixir) src/elixir.erl:134: :elixir.eval_forms/4
@darkofabijan
darkofabijan / redis.markdown
Created October 25, 2012 10:28 — forked from eskim/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

apiVersion: v1alpha
kind: Dashboard
metadata:
name: my-dashboard
title: My Dashboard
id: eb0cc2c7-bbc9-41e4-9e3d-2eb622a673fb
create_time: "1537888191"
update_time: "1537889560"
spec:
widgets:

Biggest sources of flaky tests (from our experience)

FactoryGirl

When using FactoryGirl to create records in tests, it is necessary to be aware that you are usually creating a lot more records than is obvious in the code. While this is usually harmless aside from slowing down tests, it is capable of creating some mind boggling flakiness. Some scenarios where this is probable are tests that count the number of records, tests that are expecting a certain record and assume that only it exists. Improperly set model level validations can also contribute to this.

Timestamps

defmodule MyApp.Router do
use Phoenix.Router
namespace MyApp.Controllers do
get "restaurants/:id", Restaurants, :show, as: :restaurant
resources :images
resources :users, Accounts

Typography

Headings

Headings from h1 through h6 are constructed with a # for each level:

# h1 Heading
## h2 Heading
### h3 Heading
➜ vSync git:(sharing) be rake stats
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 1446 | 1101 | 33 | 170 | 5 | 4 |
| Helpers | 297 | 239 | 0 | 29 | 0 | 6 |
| Models | 677 | 491 | 15 | 84 | 5 | 3 |
| Libraries | 1971 | 1551 | 41 | 144 | 3 | 8 |
| Model specs | 559 | 396 | 0 | 1 | 0 | 394 |
| Controller specs | 951 | 694 | 0 | 6 | 0 | 113 |
@darkofabijan
darkofabijan / gist:7157148244c3ec0cb43a
Created December 1, 2015 20:58 — forked from vrinek/gist:bda51f6fc8b22b5df301
Blizzard Software Engineering Reading

Blizzard Software Engineering Reading

by Jay Baxter (circa 2009)

Associate developer

"This list is for people who want to become Associate Software Engineers at Blizzard. An associate should have skills at the level indicated by these books. Note that this is almost completely focused on C++ programming. This list is incomplete. I need a book on how to become a professional. I've listed several books that give examples of professional behavior, but not one on the actual training."

Programming: Principles and Practice Using C++

by Bjarne Stroustrup

sudo apt-get install mercurial
hg clone https://vim.googlecode.com/hg/ vim
cd vim
./configure --enable-rubyinterp --enable-gui=no
make
sudo make install
class User < ActiveRecord::Base
def forms
Form.where(:company => company)
end
def find_form(id)
forms.find(id)
end
end