Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/testResults">
<testsuites>
<testsuite>
<xsl:for-each select="*">
<testcase>
<xsl:attribute name="classname"><xsl:value-of select="name()"/></xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="@lb"/></xsl:attribute>
@mattes
mattes / check.go
Last active April 4, 2024 22:40
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@ismasan
ismasan / sse.go
Last active March 19, 2024 18:13
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@mmdemirbas
mmdemirbas / LogFile.udl.xml
Created September 13, 2012 11:34
Custom log file syntax highlighting for Notepad++
<NotepadPlus>
<UserLang name="LogFile" ext="log">
<Settings>
<Global caseIgnored="yes" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">[(0])0</Keywords>
<Keywords name="Folder+"></Keywords>
@hyg
hyg / gist:9c4afcd91fe24316cbf0
Created June 19, 2014 09:36
open browser in golang
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@drewolson
drewolson / reflection.go
Last active November 20, 2023 09:39
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@cevaris
cevaris / struct_as_map_key.go
Last active October 20, 2023 03:18
Golang: Using structs as key for Maps
package main
import "fmt"
type A struct {
a, b int
}
func MapStructValAsKey(){
// Notice: We are using value of `A`, not `*A`
anonymous
anonymous / gmaps-drawing-tools-places.htm
Created July 1, 2015 04:54
gmaps-drawing-tools-places.htm
<!DOCTYPE html>
<!-- http://gmaps-samples-v3.googlecode.com/svn/trunk/drawing/drawing-tools.html -->
<!-- https://developers.google.com/maps/documentation/javascript/examples/places-searchbox -->
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<title>Drawing Tools (B)</title>
<!-- NOTE: two libraries to load are comma-separated; otherwise last mention of the query string arg overwrites the previous -->
<script type="text/javascript"
static {
disableSslVerification();
}
private static void disableSslVerification() {
try
{
// Create a trust manager that does not validate certificate chains
javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[] {new javax.net.ssl.X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
@olivierlacan
olivierlacan / git_log.md
Created August 2, 2012 15:06
My git log custom output aliases
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"
git config --global alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit --all"
git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"

To check that they've been added correctly, first run git config --list. You should see something like this in the midst of all your other configuration:

alias.hist=log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short