Skip to content

Instantly share code, notes, and snippets.

View zedtux's full-sized avatar

Guillaume Hain zedtux

View GitHub Profile
@zedtux
zedtux / gitHub-dark.css
Last active December 6, 2017 14:41
Stylish - Github Dark 2.0 - zedtux's improvements
/*
* GitHub Dark v2.6.0
* Copyright 2016 Quan You.
* GitHub Project (https://cquanu.github.io/github-dark/)
* Licensed under MIT (https://github.com/cquanu/github-dark/blob/master/LICENSE)
*/
/* HTML Global */
@zedtux
zedtux / mix.exs
Created November 24, 2017 14:27
Extract of the mix.exs file setting the deps_path attribute
defmodule Hello.Mixfile do
use Mix.Project
def project do
[
app: :hello,
version: "0.0.1",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
@zedtux
zedtux / docker-compose.yml
Created November 24, 2017 14:21
Docker compose file with a data container for the Elixir/Phoenix "deps" folder
version: '2'
services:
# Application database
db:
image: postgres
ports:
- "5432:5432"
volumes:
- ./db:/var/lib/postgresql
@zedtux
zedtux / wysihtml5_helpers.rb
Last active May 17, 2017 18:19 — forked from bguthrie/fill_in_wysihtml5.rb
A Capybara helper to fill in WYSIHTML5 editors. Works with multiple editors on a page.
module FillInWysihtml5Helpers
def fill_in_wysihtml5(label, options = {})
page.execute_script <<-JAVASCRIPT
var id = $("label:contains(#{label})").attr("for");
$("#" + id).data("wysihtml5").editor.setValue("#{options[:with]}");
JAVASCRIPT
end
def read_wysihtml5(label)
page.execute_script <<-JAVASCRIPT
@zedtux
zedtux / gist:a3e4d00e1bc522f89c8ccb69f34a450c
Created February 20, 2017 06:41
Docker command to execute psql and add the primary key to the institutions table
docker exec legalannouncements_database_1 psql --username=appuser --dbname=my_awesome_development psql -c 'ALTER TABLE institutions ADD PRIMARY KEY (id)'
@zedtux
zedtux / gist:290a6be86071016699a422a5679928ca
Created February 17, 2017 15:21
Docker command to import a single table
docker exec legalannouncements_database_1 pg_restore -U appuser --dbname my_awesome_development --table=institutions /db_dump/20160815_backup.sql
@zedtux
zedtux / gist:c416acae6181d4864488f16ff744ed45
Last active February 17, 2017 15:22
Docker command to drop a table
docker exec legalannouncements_database_1 psql -U appuser --dbname my_awesome_development -c "DROP TABLE institutions"
@zedtux
zedtux / docker-coming-soon-on-dockerlcoud.yml
Created January 21, 2017 09:17
DockerCloud stack file to run the Docker coming-soon image (https://github.com/zedtux/docker-coming-soon)
lb:
image: 'dockercloud/haproxy:latest'
links:
- sento-io
ports:
- '80:80'
roles:
- global
sento-io:
environment:
@zedtux
zedtux / right.rb
Created October 8, 2016 11:57
Updated Right model with deprecate method
class Right
has_many :right_levels
deprecate :levels, :right_levels
end
@zedtux
zedtux / module.rb
Created October 8, 2016 11:52
Deprecation method implementation
class Module
def deprecate(old_method, new_method)
define_method(old_method) do |*args, &block|
warn "DEPRECATION WARNING: #{old_method} is deprecated in favour of #{new_method}. (called from #{caller.first})"
send(new_method, *args, &block)
end
end
end