Skip to content

Instantly share code, notes, and snippets.

View zorbash's full-sized avatar
👨‍💻
'); DROP TABLE recruiters;

Dimitris Zorbas zorbash

👨‍💻
'); DROP TABLE recruiters;
View GitHub Profile
defmodule Document.UpdatePipeline do
use Opus.Pipeline
check :validate_params, with: &match(%{"id" => id} when is_number(id), &1.params)
step :fetch_document, with: &(put_in &1[:document], Document.get(get_in(&1, [:params, "id"])), error_message: :not_found
check :can_view?, with: &Authorizer.can_view(&1.document, &1.user)
check :can_edit?, with: &Authorizer.can_view(&1.document, &1.user)
step :update, with: &(put_in &1[:updated_document], Documents.update(&1.document, &1.params))
tee :notify, with: &Notifications.push_document_updated(&1.updated_document)
step :finalize, with: &(&1.updated_document)
@zorbash
zorbash / example.ex
Created December 18, 2017 21:04
Happy Place - 2
defmodule Example
@pubsub ExampleApp.PubSub
@spec websocket_connections([non_neg_integer]) :: non_neg_integer
def websocket_connections([_ | _] = shards) do
shards
|> Enum.map(&Phoenix.PubSub.Local.local_name(@pubsub, &1))
|> Enum.reduce(0, fn name, acc ->
with pid when is_pid(pid) <- Process.whereis(name),
info when is_list(info) <- Process.info(pid, [:monitors])[:monitors],
# File: /etc/apt/apt.conf.d/docker-autoremove-suggests
# Since Docker users are looking for the smallest possible final images, the
# following emerges as a very common pattern:
# RUN apt-get update \
# && apt-get install -y <packages> \
# && <do some compilation work> \
# && apt-get purge -y --auto-remove <packages>
# By default, APT will actually _keep_ packages installed via Recommends or
@zorbash
zorbash / kitto_updater.sh
Last active February 21, 2017 11:56
Kitto Core Widgets Updater
main() {
set -e
github_base_url=https://raw.githubusercontent.com/kittoframework/kitto/master
print_banner
ask_continue
update_widgets
print_outro
}
@zorbash
zorbash / kitto_updater.sh
Created February 21, 2017 11:40
Kitto Updater Script (for version >= 0.5.1)
main() {
set -e
github_base_url=https://raw.githubusercontent.com/kittoframework/kitto/master
print_banner
ask_continue
update_configs
update_widgets
@zorbash
zorbash / kitto.service
Created January 29, 2017 20:25
Kitto systemd unit file
[Unit]
Description=Kitto Server
[Service]
Type=simple
User=deployer
User=deployer
EnvironmentFile=/etc/default/kitto
ExecStart=/usr/local/bin/elixir --no-halt --no-compile --no-deps-check --name kitto@127.0.0.1 -S mix kitto.server
WorkingDirectory=/var/www/apps/kitto
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased
### Added
* Experimental support for Uranus expedition
@zorbash
zorbash / software_packaging_guidelines.md
Last active January 19, 2017 21:40
Software Packaging Guidelines

Software Packaging Guidelines

License

Without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work.

Without an open-source license it can be hard for people using your software to be aware in what terms they may contribute back changes or even fork your project.

@zorbash
zorbash / roadmap.md
Created January 9, 2017 18:43
Kitto Roadmap

Kitto Roadmap

  • Package JS Core Lib in hex package
  • Exponential back-off for failing jobs
  • Themable widgets
  • View Partials
  • HTTP commands
  • Webhooks / Additional Routes

Keybase proof

I hereby claim:

  • I am zorbash on github.
  • I am zorbash (https://keybase.io/zorbash) on keybase.
  • I have a public key ASBl2ayUhKqqsl25V4ZwUjzCyidzdGMkqEunbXJS6uXNWwo

To claim this, I am signing this object: