Skip to content

Instantly share code, notes, and snippets.

View fagnercarvalho's full-sized avatar

Fagner Nunes Carvalho fagnercarvalho

View GitHub Profile
Testing out.
@fagnercarvalho
fagnercarvalho / getColumnValues.js
Last active August 29, 2015 14:25
Simple code for selecting a whole column from a table. I use sometimes for copying data that is not easily available in JSON or XML.
function getColumnValues(columnNumber) {
$("table tr td:nth-child(" + columnNumber + ")").each(function() {
console.log($(this).text());
});
}
// usage
getColumnValues(1)
@fagnercarvalho
fagnercarvalho / renameFilesWithShift.csx
Last active October 10, 2015 03:23
Rename a bunch of files in a specific directory using a shift to increase or decrease their order. The files need to be in the following format: 00_file.txt
using System;
using System.IO;
var directory = @"C:\directory\";
var shift = 3;
foreach(var file in Directory.GetFiles(directory)) {
var fileName = Path.GetFileName(file);
var currentNumber = Int64.Parse(fileName.Substring(0, 2));
@fagnercarvalho
fagnercarvalho / git-ssh.md
Last active October 9, 2015 20:23
I'm sick and tired of keeping trying to remember all commands to associate a new SSH key to my Github account so I did that.

generate

  • ssh-keygen -t rsa -b 4096 -C "email"

associate

  • ``eval `ssh-agent -s```
  • ssh-add "C:/Users/Fagner/.ssh/id_rsa"
  • use the 'Add SSH key' option in Github and copy and paste the content from id_rsa.pub
public class SessionIdGenerator {
public string static GenerateSessionId() {
var httpClient = new HttpClient();
var content = new StringContent("email=YOUR_EMAIL&token=YOUR_TOKEN", Encoding.GetEncoding("ISO-8859-1"), "application/x-www-form-urlencoded");
var response = await httpClient.PostAsync("https://ws.sandbox.pagseguro.uol.com.br/v2/sessions", content);
string sessionId = string.Empty;
if (response.IsSuccessStatusCode)
{
var xmlContent = await response.Content.ReadAsStreamAsync();
@fagnercarvalho
fagnercarvalho / git-editor.md
Created November 24, 2015 15:54
Configure default editor in Git as Notepad++

git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

@fagnercarvalho
fagnercarvalho / HelloWorld.fs
Created December 6, 2015 07:17
My first program in F#! 😄
System.Console.WriteLine("Type your name.")
let name = System.Console.ReadLine()
printfn "Hello World %s!" name
ignore(System.Console.Read())