Skip to content

Instantly share code, notes, and snippets.

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

Leticia Alves leticiaalves

🏠
Working from home
View GitHub Profile
@camh-
camh- / eol-at-eof.md
Created March 7, 2020 04:41
Please add newlines at end of files

See https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

A newline in a text file is a terminator, not a separator. This means each line should have a newline at the end of it, including the last line of the file.

Many editors automatically add the newline at the end of the file. Some do not. If you can configure your editor to ensure there is always a newline at the end of every line, please do so.

Because many editors do add this newline, if you commit a text file without it, when someone else edits the file, their editor will (correctly) add the newline. This causes a spurious diff in the file. Spurious

@troyfontaine
troyfontaine / 1-setup.md
Last active May 3, 2024 10:52
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@henriquemenezes
henriquemenezes / curl-upload-file.sh
Last active September 12, 2023 20:19
Using CURL to Upload Files
# curl - Raw upload
curl -X PUT -T image.png https://example.com/upload
# curl - Content-Type: multipart/form-data
curl -F name=logo -F file=@image.png https://example.org/upload
# curl - POST presigned URL (S3)
@stewsters
stewsters / Slack message
Last active September 17, 2020 01:29
This sends messages as slackbot to slack
/**
* This sends messages as slackbot to slack using groovy
*/
String.metaClass.encodeURL = {
java.net.URLEncoder.encode(delegate, "UTF-8")
}
def address = "https://slack.com/api/"
def method = "chat.postMessage"
@leocomelli
leocomelli / git.md
Last active May 8, 2024 16:38
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

@mariuszs
mariuszs / MyTest.java
Last active March 19, 2024 10:08
Mockito + Catch Exception + AssertJ - BDD Style!
import com.googlecode.catchexception.MyException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
import static com.googlecode.catchexception.apis.BDDCatchException.when;
import static org.assertj.core.api.BDDAssertions.then;
@oleg
oleg / BddTest.java
Created February 27, 2012 18:46
Mockito BDD style
package logic;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.matchers.JUnitMatchers.hasItem;