Skip to content

Instantly share code, notes, and snippets.

View tiagopotencia's full-sized avatar

Tiago Brandão tiagopotencia

View GitHub Profile
import java.util.List;
import java.util.regex.Pattern;
import javafx.application.*;
import javafx.collections.FXCollections;
import javafx.event.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.effect.*;
import javafx.scene.image.*;
import javafx.scene.web.HTMLEditor;
import java.util.List;
import java.util.regex.Pattern;
import javafx.application.*;
import javafx.collections.FXCollections;
import javafx.event.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.effect.*;
import javafx.scene.image.*;
import javafx.scene.web.HTMLEditor;
package main
import (
"fmt"
)
type x struct {
id *int
}
@tiagopotencia
tiagopotencia / detect android or ios
Created March 27, 2017 16:54
Detects if is Android or IOS. This code is very useful and i don't want to go Stackoverflow every time i need it LOL.
function getMobileOperatingSystem() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
if (/android/i.test(userAgent)) {
return "Android";
}
// iOS detection from: http://stackoverflow.com/a/9039885/177710
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
return "iOS";
@tiagopotencia
tiagopotencia / detect android or ios
Last active March 27, 2017 16:54
Detects if is Android or IOS. This code is very useful and i don't want to go Stackoverflow every time i need it LOL. Code from: http://stackoverflow.com/a/21742107
function getMobileOperatingSystem() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
if (/android/i.test(userAgent)) {
return "Android";
}
// iOS detection from: http://stackoverflow.com/a/9039885/177710
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
return "iOS";
@tiagopotencia
tiagopotencia / GoCDVEnvironmentVariables.js
Last active June 28, 2017 17:10
Fill the Environment variables Form
jQuery("#add_variables").click();
var environmentVariablesDiv = jQuery(".form_content")[0];
var paramList =[
["SETPARAM_param", "value"],
];
var secureList =[
["SETPARAM_param", "value"],
@tiagopotencia
tiagopotencia / Convert interface{} to []string
Created August 1, 2017 14:12
Using type assertion we can get the type of an interface{}. Go's already knows that value and says it if you try to make a wrong convertion.
package main
import (
"fmt"
)
func main() {
type interfaceToStringSliceStruct struct {
interfaceToStringSlice interface{}
}
@tiagopotencia
tiagopotencia / WorkingWithChannels.go
Last active December 12, 2017 21:48
Working with channels in Go
package main
import (
"github.com/gin-gonic/gin"
"fmt"
)
var (
channel chan int
)
@tiagopotencia
tiagopotencia / httplogger.go
Created January 26, 2018 13:53
HttpLoggerMiddleware
package httplogger
import (
"github.com/gin-gonic/gin"
"time"
"fmt"
"log"
)
func LogRequestInfo(notlogged ...string) gin.HandlerFunc {
@tiagopotencia
tiagopotencia / httplogger.go
Created January 26, 2018 13:53
HttpLoggerMiddleware
package httplogger
import (
"github.com/gin-gonic/gin"
"time"
"fmt"
"log"
)
func LogRequestInfo(notlogged ...string) gin.HandlerFunc {