Skip to content

Instantly share code, notes, and snippets.

View Wigny's full-sized avatar

Wígny Almeida Wigny

  • Up Learn
  • Ji-Paraná - RO
  • 08:45 (UTC -04:00)
View GitHub Profile
@chrismccord
chrismccord / dev.exs
Created May 8, 2024 20:06
Live Reload LiveView notify
config :wps, WPSWeb.Endpoint,
live_reload: [
notify: [
live_view: [
~r"lib/wps_web/core_components.ex$",
~r"lib/wps_web/(live|components)/.*(ex|heex)$"
]
],
patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
Mix.install([:mint, :castore])
defmodule Main do
def run() do
total =
Stream.resource(
fn ->
{:ok, conn} = Mint.HTTP.connect(:https, "ftp.bit.nl", 443, mode: :passive)
{:ok, conn, _ref} = Mint.HTTP.request(conn, "GET", "/speedtest/10mb.bin", [], nil)
{conn, true}
@char0n
char0n / api_data_structure.ex
Last active August 1, 2022 16:03
Model example how to use Ecto to validate nested JSON data in you API payloads
defmodule ApiDataStructure do
defmodule User do
use Ecto.Schema
import Ecto.Changeset
alias ApiDataStructure.Profile
embedded_schema do
field :username, :string
@tggo
tggo / object.detection.py
Created March 4, 2019 12:52
Real-Time Object Detection in OpenCV with Automatic Perspective Correction!
# Real-Time Object Detection in OpenCV with Automatic Perspective Correction!
# https://www.youtube.com/watch?v=kLnkAZCwZX0
# (c) Izhar Shaikh
# from https://robosifo.wordpress.com/2015/11/21/weekly-report-11/
# import the necessary packages
import time
import cv2
import numpy as np
#Difference Variable
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active June 29, 2024 22:33
Conventional Commits Cheatsheet

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@tzmartin
tzmartin / embedded-file-viewer.md
Last active June 28, 2024 14:24
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@josevalim
josevalim / watcher.sh
Last active May 22, 2024 10:06
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
@felipecwb
felipecwb / cnhValidation.js
Last active November 16, 2022 01:16
CNH (Carteira Nacional de Habilitação) validation in JS
function validateCNH(cnh) {
var char1 = cnh.charAt(0);
if (cnh.replace(/[^\d]/g, '').length !== 11 || char1.repeat(11) === cnh) {
return false;
}
for (var i = 0, j = 9, v = 0; i < 9; ++i, --j) {
v += +(cnh.charAt(i) * j);
}