Skip to content

Instantly share code, notes, and snippets.

View vagnernogueira's full-sized avatar

Vagner Nogueira vagnernogueira

View GitHub Profile
@ljharb
ljharb / array_iteration_thoughts.md
Last active April 29, 2024 17:13
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@evantoli
evantoli / GitConfigHttpProxy.md
Last active April 26, 2024 17:21
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@ericelliott
ericelliott / essential-javascript-links.md
Last active April 22, 2024 10:15
Essential JavaScript Links
@shawndumas
shawndumas / .gitconfig
Created August 5, 2013 19:08
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@jcraane
jcraane / logback.xml
Created July 3, 2013 18:26
Sample logback.xml file with console and rolling file appender. The rollover is time based (daily) and size based, 5MB.
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset>
<Pattern>%d %-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
@vagnernogueira
vagnernogueira / centos-7-package.sh
Last active October 1, 2022 23:01 — forked from clivewalkden/centos-7-package.sh
How to add VirtualBox Guest Additions for vagrant into minimal install of Cent OS 7.
# Start the old vagrant
$ vagrant init centos-7
$ vagrant up
# You should see a message like:
# Installing Virtualbox Guest Additions 5.0.20 - guest version is unknown
$ vagrant ssh
# corrigir erro de yum
@luis-fss
luis-fss / convertUTF8toISO-description.txt
Created March 1, 2012 20:48
Convertendo de UTF-8 para ISO-8859-1 em Java: A solução definitiva
Recentemente enfrentei problemas em um aplicativo Android que desenvolvi, o qual se comunica com o banco de dados de um dos sistemas da empresa, codificado em ISO-8859-1 (Firebird) através de um web service.
Os dados eram gravados de forma errada, muitas vezes truncavam e as vezes apareciam caracteres estranhos.
Depois de algumas tentativas, cheguei até a seguinte solução:
@vagnernogueira
vagnernogueira / bogonsblocks.sh
Last active May 25, 2022 13:08
Firewall-D and IPSETs
#!/bin/bash
# geoip on firewall in centos 7
# this file: /etc/cron.weekly/bogonsblocks.sh
# sudo chmod +x /etc/cron.weekly/bogonsblocks.sh
## create tmp dir
# sudo mkdir /var/tmp/ipbogons
## create list on ipset
# sudo ipset create bogonslist hash:net maxelem 1000000
## create rule on firewall-cmd
@jgilfelt
jgilfelt / CurlLoggingInterceptor.java
Created January 9, 2016 15:34
An OkHttp interceptor that logs requests as curl shell commands
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@tunjos
tunjos / copyReleaseApkToCustomDir.gradle
Last active December 8, 2021 03:10
Copy release apk to custom directory
def publish = project.tasks.create("copyReleaseApkToCustomDir")
publish.description "Copies release apk to custom directory"
android.applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.outputs.each { output ->
if ( output.outputFile != null && output.outputFile.name.endsWith('.apk')) {
def task = project.tasks.create("copyAndRename${variant.name}Apk", Copy)
def outputFile = output.outputFile
println "Creating " + rootProject.name + "-${versionName}.apk" + " from " + project.name + "-${variant.name}.apk"