Skip to content

Instantly share code, notes, and snippets.

View gullitmiranda's full-sized avatar
🌎
Working from anywhere

Gullit Miranda gullitmiranda

🌎
Working from anywhere
View GitHub Profile
@gullitmiranda
gullitmiranda / deployment.yaml
Created February 22, 2022 23:19
Elixir + k8s startup/liveness/readiness probs
spec:
template:
spec:
containers:
- name: {{ .Chart.Name }}
# ...
#
## Application health checks
# initialDelaySeconds: Number of seconds after the container has started before startup, liveness or readiness probes are initiated.
# periodSeconds: How often (in seconds) to perform the probe. Default to 10 seconds. The minimum value is 1.
@nuxlli
nuxlli / init.fish
Created July 6, 2020 14:47
Fish k8s alias and scripts
function av-exec
aws-vault exec $argv[1] -- $argv[2..-1]
end
function av-shell
av-exec $argv[1] fish
end
alias kexec-dev="kubectl-exec firma-dev"
alias kexec-stage="kubectl-exec firma-stage"
@ebidel
ebidel / coverage.js
Last active September 24, 2023 10:25
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
@nuxlli
nuxlli / README.md
Created July 14, 2016 18:19
Testing `react-native` applications

Sobre

Não é simples fazer testes de aplicações react-native no device, por isso a maior parte das pessoas preferem testar separadamente os componentes (test unitários) usando o node.js e usar outras ferramentas para test de integração.

Dessa forma os testes unitários são como qualquer outro teste node.js. Você é livre para usar qualquer framework de testes, apesar da documentação oficial recomendar o uso do jest.

Pontos chave

  • Referências: Por se tratar de uma tecnologia em franca fase de desenvolvimento, muitas das referências para react-native estão desatualizadas ou imprecisas. Tome bastante cuidado principalmente no que se refere a syntax de ES5 e ES6;
@josevalim
josevalim / watcher.sh
Last active February 28, 2024 07:42
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
# You will need fswatch installed (available in homebrew and friends)
# The command below will run tests and wait until fswatch writes something.
# The --stale flag will only run stale entries, it requires Elixir v1.3.
fswatch lib/ test/ | mix test --stale --listen-on-stdin
@christopherstott
christopherstott / import_zsh_history_to_fish.js
Created January 23, 2016 23:39
Import ZSH history to Fish
'use strict';
const fs = require('fs');
const expandHomeDir = require('expand-home-dir');
const zshHistoryRaw = fs.readFileSync(expandHomeDir('~/.zsh_history'), 'utf8');
const zshHistoryLines = zshHistoryRaw.split('\n');
const transformLine = line => {
try {
@nuxlli
nuxlli / Azkfile.js
Created November 3, 2015 20:37
"bins" example in Azkfile
aliases({
bundle : { command: ["bundle", "exec"]}, // system: azkdemo (default)
scaffold : { alias: "bundle", append: ["rails", "g", "scaffold"]},
test : { alias: "bundle", append: ["rake", "test"], tty: true, context: 'test'},
'import-db': { system: "mysql", command: ["mysql"], depends: false}
});
// azk script generator --path ./script
// ./script/bundle
// ./script/scaffold
@chrismccord
chrismccord / phoenix-0.15-upgrade.md
Last active August 29, 2015 14:25
Phoenix upgrade instructions 0.14.x to 0.15.0

Sockets and Channels

A new socket behaviour has been introduced to handle socket authentication in a single place, wire up default channel assigns, and disconnect a user's multiplex connection as needed.

First things first, create a UserSocket module in web/channels/user_socket.ex and move all your channel routes from web/route.ex to the user socket: (replace MyApp with your application module)

0.14.x - web/router.ex:

defmodule MyApp.Router do
   ...
defmodule Morgue.Repo do
use Ecto.Repo, otp_app: :my_awesome_app
def log(entry) do
result = super(entry)
time = (entry.query_time + entry.queue_time) / 1_000
:ok = :exometer.update ~w(tracker ecto query_exec_time)a, time
:ok = :exometer.update ~w(tracker ecto query_count)a, 1
result
end
@gullitmiranda
gullitmiranda / docker_cheat_sheet.md
Last active May 11, 2016 02:35
Clean Docker images and containers cheat sheet.

Docker Cheat Sheet

NOTE: if you are using the docker without the http://azk.io installed, use docker instead of adocker.

Kill running containers

adocker kill $(adocker ps -q | tr '\r\n' ' ')