Skip to content

Instantly share code, notes, and snippets.

View lucivaldo's full-sized avatar
🏠
Working from home

Lucivaldo lucivaldo

🏠
Working from home
View GitHub Profile
@lucivaldo
lucivaldo / getGitLabIssuesByMilestone.js
Last active September 18, 2021 17:38
Exemplo de código JS para realizar várias chamadas assíncronas para API backend utilizando iterables e for await...of
const fetchAllResources = async (resources, params) => {
const asyncIterable = {
[Symbol.asyncIterator]() {
return {
page: '1',
finished: false,
async next() {
if (!this.finished) {
const response = await api.get(resources, {
params: { ...params, page: this.page },
@lucivaldo
lucivaldo / config.fish
Last active January 22, 2021 16:17
My fish config
# Android Studio
#set -x ANDROID_STUDIO_HOME $HOME/android-studio
#set PATH $ANDROID_STUDIO_HOME/bin $PATH
# Configurações para Cordova
set -x ANDROID_SDK_ROOT $HOME/Android/Sdk
set -x ANDROID_HOME $HOME/Android/Sdk
set PATH $HOME/.sdkman/candidates/gradle/6.6.1/bin $PATH
# Configurações para Ionic
@luzfcb
luzfcb / installing_pyenv_on_ubuntu_based_distros.md
Last active May 2, 2024 17:51
Quick install pyenv and Python

Tested only on Ubuntu 22.04, KDE Neon User Edition (based on Ubuntu 22.04) and OSX Mojave or higher.

will probably work on other newer versions, with no changes, or with few changes in non-python dependencies (apt-get packages)

NOTE: Don't create a .sh file and run it all at once. It may will not work. Copy, paste, and execute each command below manually. :-)

Ubuntu

# DO NOT RUN THIS AS A ROOT USER
@jmflannery
jmflannery / application_controller.rb
Created October 28, 2016 15:21
authenticate_with_http_token example in a rails controller
def authenticate_token
@user = authenticate_with_http_token do |key, options|
token = Token.find_by key: key
token.user if token
end
head 401 unless @user
end
@jacksonpires
jacksonpires / bootbox-rails.js
Created October 12, 2016 19:31
Sobrescreve o data-confirm do Rails pelo bootbox.js
$.rails.allowAction = function(element) {
var message = element.attr('data-confirm');
if (!message) { return true; }
var opts = {
title: "Confirmação",
message: message,
buttons: {
confirm: {
label: 'Sim',
ESTADOS_BRASILEIROS = [
["Acre", "AC"],
["Alagoas", "AL"],
["Amapá", "AP"],
["Amazonas", "AM"],
["Bahia", "BA"],
["Ceará", "CE"],
["Distrito Federal", "DF"],
["Espírito Santo", "ES"],
["Goiás", "GO"],
@J2TEAM
J2TEAM / sublime-text-scopes.md
Last active January 17, 2024 22:44 — forked from iambibhas/scopes.txt
Sublime Text 2/3: Snippet scopes

Here is a list of scopes to use in Sublime Text 2/3 snippets -

ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 22, 2024 02:29
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@hopsoft
hopsoft / db.rake
Last active July 5, 2024 14:52
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd