Skip to content

Instantly share code, notes, and snippets.

View MartinP7r's full-sized avatar
📱

Martin Pfundmair MartinP7r

📱
View GitHub Profile
@MartinP7r
MartinP7r / endOfSheet.bas
Last active August 29, 2015 14:01
returns the (actual) last row of the current Excel Sheet
Function endOfSheet(Optional targetSheet As Worksheet) As Long
'' returns the (actual) last row of the current sheet
' this is far better than using '65536' or whatever the current row size might be,
' especially since .xlsx has 2^20 (1048576), not 2^16.
If targetSheet Is Nothing Then
Set targetSheet = ActiveWorkbook.ActiveSheet
End If
endOfSheet = targetSheet.Rows.Count
End Function
@MartinP7r
MartinP7r / ERParser.java
Last active August 29, 2015 14:01
Parses ECB €-exchange rates feed into objects arraylist-list <EuroExchangeRate> "ratesList"
package exchangeRateApp;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction;
import javax.xml.parsers.DocumentBuilder;
@MartinP7r
MartinP7r / IsLetter.bas
Created May 26, 2014 10:25
checks if the String consists only of letters (A-Z, a-z) or not
'source: http://techniclee.wordpress.com/2010/07/21/isletter-function-for-vba/
Function IsLetter(strValue As String) As Boolean
Dim intPos As Integer
For intPos = 1 To Len(strValue)
Select Case Asc(Mid(strValue, intPos, 1))
Case 65 To 90, 97 To 122
IsLetter = True
Case Else
IsLetter = False
Exit For
@MartinP7r
MartinP7r / createShortcuts.vbs
Last active August 29, 2015 14:02
creates shortcuts in ShortcutFolder for all Application files (*.exe) in all level-1 subfolders of the specified target folders
'+-------------------------------------+
'| @author: Martin Pfundmair |
'| @version: 1.0 |
'| @date: 2014-05-31 |
'| |
'| $cript: |
'| creates shortcuts in ShortcutFolder |
'| for all Application files (*.exe) |
'| in all level-1 subfolders of the |
'| specified target folders |
{"lastUpload":"2021-10-30T05:17:01.742Z","extensionVersion":"v3.4.3"}
@MartinP7r
MartinP7r / SignInService.swift
Last active June 23, 2018 23:03
medium_post
protocol SignInService {
func signIn(_ completion: @escaping (_ id: String?) -> Void)
func signOut()
}
@MartinP7r
MartinP7r / SomeSignInService.swift
Last active June 23, 2018 12:36
medium_post_002
class SomeSignInService: SignInService {
init() {
// do whatever the provider needs to be set up
}
func signIn(_ completion: @escaping (String?) -> Void) {
// call the sign in service and receive a token
completion(token)
}
@MartinP7r
MartinP7r / Authenticator.swift
Last active June 24, 2018 06:17
medium_post_03
class Authenticator {
let userDataService = UserDataService()
func auth(using signInService: SignInService,
_ completion: @escaping (_ user: User?) -> Void) {
signInService.signIn { token in
userDataService.load(forToken: token) { user in
completion(user) // note: error handling omitted for brevity
@MartinP7r
MartinP7r / GIDSignIn.h
Created June 24, 2018 00:20
medium_post_04
// Starts the sign-in process. The delegate will be called at the end of this process.
// (...)
- (void)signIn;
// The sign-in flow has finished and was successful if |error| is |nil|.
- (void)signIn:(GIDSignIn *)signIn
didSignInForUser:(GIDGoogleUser *)user
withError:(NSError *)error;
@MartinP7r
MartinP7r / GoogleSignInService.swift
Last active June 24, 2018 06:16
medium_post_05
class GoogleSignInService: NSObject, SignInService, GIDSignInDelegate, GIDSignInUIDelegate {
// intermediary closure to be called when sign-in finishes
var signedIn: ((String) -> Void)?
func setup() { /* (...) */ }
func signIn(_ completion: @escaping (String) -> Void) {
// hand own completion block to intermediary closure