Skip to content

Instantly share code, notes, and snippets.

View andreapavoni's full-sized avatar
🎧
❤️‍🔥🪩🕺🏻🚀

Andrea Pavoni andreapavoni

🎧
❤️‍🔥🪩🕺🏻🚀
View GitHub Profile
@andreapavoni
andreapavoni / Event-stream based GraphQL subscriptions.md
Created October 8, 2018 13:27 — forked from OlegIlyenko/Event-stream based GraphQL subscriptions.md
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@andreapavoni
andreapavoni / Flexible Dockerized Phoenix Deployments.md
Created May 12, 2018 18:02 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@andreapavoni
andreapavoni / README.md
Created November 23, 2016 12:05 — forked from felipegasparini/README.md
Ecto Postgres tsrange data type
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Modify by linuz.ly
package main
import (
"bytes"
"fmt"
"code.google.com/p/go.crypto/ssh"

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

#commit model
class Commit < ActiveRecord::Base
# 1) We don't need a provider based Commit subclass, a String field
# should be enough. In case, we can associate a Provider model
# (1 to 1 relation) that represents a specific provider
# 2) we might want to use commit IDs, then build the commit URL at runtime
# (perhaps an URL template specific to the provider should be specified in Provider model)
# this shuould prevent eventual URL changes by providers :-)
attr_accessible :commit_url, :author, :commit_message, :provider
package main
import (
"code.google.com/p/go.net/websocket"
)
type connection struct {
// The websocket connection.
ws *websocket.Conn
# app/controllers/custom_devise/password_controller.rb
class CustomDevise::PasswordsController < Devise::PasswordsController
def resource_params
params.require(resource_name).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
@andreapavoni
andreapavoni / inject_vs_plus.rb
Created November 14, 2012 09:58 — forked from rentalcustard/inject_vs_plus.rb
inject vs plus vs concat
require 'benchmark'
class PerfTest
def with_inject(array)
mapped_vals.inject(array, :<<)
end
def with_plus(array)
array + mapped_vals
end
@andreapavoni
andreapavoni / myleakedin.rb
Created June 7, 2012 12:51 — forked from riffraff/gist:2882358
linkedin dump password check
#!/usr/bin/env ruby
# USAGE: ruby myleakedin.rb yourpassword
# assumes you have the dump in the same dir as combo_not.txt
require 'digest/sha1'
pass = ARGV.first
hex = Digest::SHA1.hexdigest(pass)
print "HEX: #{hex} => "