Skip to content

Instantly share code, notes, and snippets.

@chawel
chawel / dotnetpowershellftp.ps1
Last active June 14, 2018 20:44
Skrypt w PowerShell do modyfikacji pliku i wrzucania na serwer FTP
$RemoteFile = "https://adres_strony/nazwa_pliku_do_pobrania.xml"
# Dane do FTP
$Username = "login_do_ftp"
$Password = "haslo_do_ftp"
$UploadFile = "ftp://adres_serwera_ftp/nazwa_pliku_na_serwerze.xml"
# Tymczasowe pliki
$LocalFile = "file.xml"
$ChangedLocalFile = "file_changed.xml"
@chawel
chawel / find_similar.gs
Last active June 7, 2018 21:50
Google Spreadsheet script: Finds all similar texts in range (using difflib.js, percentage similarity)
/**
* To use this script You must also add difflib module.
* https://github.com/qiao/difflib.js
* Add to project as difflib.gs minified version:
* https://raw.githubusercontent.com/qiao/difflib.js/master/dist/difflib-browser.js
*/
function onOpen() {
SpreadsheetApp.getUi().createAddonMenu()
.addItem('Copy to new sheet', 'findSimilar')
@chawel
chawel / on_edit_trigger.gs
Last active June 7, 2018 21:36
Google Spreadsheet script: Monitors specific column and comments when edited (adds modification date)
function onEdit(e){
var sheet = e.source.getActiveSheet();
var editedCell = sheet.getActiveCell();
// w tym przykładzie monitorujemy 6 kolumnę
if(editedCell.getColumn() == 6){
editedCell.setNote('Last modified: ' + new Date());
}
}
@chawel
chawel / create_sheet_with_unique_rows.gs
Last active June 7, 2018 21:33
Google Spreadsheet script: Create sheet with rows containing first occurrence of values in selected range
// Dodaje nową pozycję do menu
function onOpen() {
SpreadsheetApp.getUi().createAddonMenu()
.addItem('Copy to new sheet', 'copyUniques')
.addToUi();
}
// Funkcja pomocnicza porównująca 2 wartości
function isUnique(left, right) {
return left == right